Python Forum
Pandas Tutor for geopandas
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pandas Tutor for geopandas
#1
Question 
Pandas Tutor can't import the geopandas library. I'm trying to understand a short function.
def dauphin_precs(row):
    nm = row['MCD_NAME']
    if row['WARD']:
        nm = nm + ' ' + row['WARD']
    if row['PRECINCT']:
        nm = nm + ' ' + row['PRECINCT']
    return nm
dauphin_gdf = geopandas.read_file('/Users/admin/Desktop/PA/2018/map/Voting_Districts-shp')
dauphin_gdf['original_precinct_name'] = dauphin_gdf.apply(lambda row: dauphin_precs(row), axis=1)
To avoid line 8 causing an error (without importing geopandas), can it be replaced with the inputted table (attached)? If yes, how? Thanks.
Reply


Messages In This Thread
Pandas Tutor for geopandas - by rootsmusic - Apr-21-2022, 01:20 AM
RE: Pandas Tutor for geopandas - by jefsummers - Apr-21-2022, 11:12 AM
RE: Pandas Tutor for geopandas - by rootsmusic - Apr-21-2022, 04:01 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020