NYCPlanning / db-factfinder

data ETL for population fact finder (decennial + acs)
https://nycplanning.github.io/db-factfinder/factfinder/
MIT License
2 stars 3 forks source link

resolve copy warning #34

Closed SPTKL closed 3 years ago

SPTKL commented 3 years ago

update a copy instead of on the dataframe directly https://github.com/NYCPlanning/db-factfinder/blob/8c2135981897df01ea865234a02ca70afa1470eb/factfinder/main.py#L253

e = df_pivot.e.copy()

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  e["e"] = results.loc[e.index == results.census_geoid, "e"].to_list()
grpintc NTA
grpintc cd
/home/runner/work/db-factfinder/db-factfinder/factfinder/main.py:254: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead