成功解决A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,co
解决问题
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: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
解决思路
参考文章 http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
当向列表中增加一列时,需要先将变量复制一份,再添加才可以
a=a.copy() a['column01']= column
赞 (0)