Created
November 2, 2018 11:28
-
-
Save glemaitre/98394fa7ec65439ca961fc0384f07aaa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [16]: df = pd.DataFrame({'A': [1, 2, 1, 2, 1, 2, 3, 3]}) | |
In [17]: df2 = df[df['A'].isin([1, 2])] | |
In [18]: df2.loc[df2['A'] == 1, 'A'] = 4 | |
/home/glemaitre/miniconda3/lib/python3.7/site-packages/pandas/core/indexing.py:189: SettingWithCopyWarning: | |
A value is trying to be set on a copy of a slice from a DataFrame | |
See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy | |
self._setitem_with_indexer(indexer, value) | |
/home/glemaitre/miniconda3/bin/ipython:1: SettingWithCopyWarning: | |
A value is trying to be set on a copy of a slice from a DataFrame | |
See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy | |
#!/home/glemaitre/miniconda3/bin/python |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment