我有一个关于如何切片数据帧并将数据帧存储为单独对象的简单问题。
例如,我拥有数据帧df,然后我做到了:
subset = df.iloc[0:5,]
但是我得到了错误:
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pandas/core/frame.py:3781: 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
return super(DataFrame, self).rename(**kwargs)