Skip to content

Suppressed Pandas SettingWithCopyWarning

Cecilia Nievas requested to merge fix/pandas_warning_view_copy into master

I searched for and tried out alternative ways of coding GDEProcessor._recalculate_building_classes_proportions() to avoid this warning from Pandas:

  /home/cnievas/Documents/GFZ_local/GDE/00_repos/gde-core/gdecore/processor.py:698: 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
  
  See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy

but nothing worked. I am suppressing the warning with this MR, otherwise it contaminates the on-screen output and makes it difficult to follow what is going on in the run. This could be refactored in the future, if a solution is found.

Merge request reports