I tried to change some of the cells of a dataframe but I still get the SettingWithCopyWarning without replacing what I want. In effect with:
df.loc[df["subject"]!="subject1"]["Activity"] = np.nan
I got:
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:1: 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
"""Entry point for launching an IPython kernel.
And when I tried to visualize this, nothing has changed:
161280 0
161281 0
161282 0
161283 0
161284 0
..
1215740 0
1215741 0
1215742 0
1215743 0
1215744 0
Name: Activity, Length: 1054465, dtype: int64