How to avoid SettingWithCopyWarning?

12 views Asked by At
projects_df = pd.json_normalize(col_added_ls)
columns_to_replace = projects_df.columns.difference(['resources'])
projects_df[columns_to_replace].replace(to_replace='[]', value='', inplace=True)

col_added_ls it holds list of column. At third line i am getting error as below - /var/task/test.py:82: 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

I tired using below - pd.options.mode.chained_assignment = None

But i belive thats not an ideal solution to deal with this warning. How to avoid this error ?

0

There are 0 answers