I am trying to assign values to rows where a condition is verified (
for i in range(0,3): new_dataset=df[str(i)][df[str(i)]["Current Amount"] != "3m"] for i in range(0,3): df[i]['Value'] = np.where(df[i]['Amount']== True, 100, 50)
i can span from
Value is the new column that I would like to create;
Amount is a column already existing in the original dataframe. In the first part, I create new dataframes filtering rows having current amounts equal to 3 million.
/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:4: 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 after removing the cwd from sys.path.
I have tried to follow the steps suggested in this post: How to deal with SettingWithCopyWarning in Pandas?, but it seems that it is still continuing to be not clear to me how to fix the issue.