Apr-21-2022, 01:20 AM
(This post was last modified: Apr-21-2022, 01:20 AM by rootsmusic.)
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.