成功解决SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame See

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._update_inplace(new_data)

解决思路

带复制警告的设置:
试图在数据帧切片的副本上设置值
请参阅文档中的注意事项:http://pandas.pydata.org/pandas docs/stable/indexing.html索引视图与副本
自我更新(新数据)

解决方法

参阅:http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html

该问题是警告信息,不处理亦可运行程序,只需理解一下即可!

The axis labeling information in pandas objects serves many purposes:

Identifies data (i.e. provides metadata) using known indicators, important for analysis, visualization, and interactive console display.
Enables automatic and explicit data alignment.
Allows intuitive getting and setting of subsets of the data set.
In this section, we will focus on the final point: namely, how to slice, dice, and generally get and set subsets of pandas objects. The primary focus will be on Series and DataFrame as they have received more development attention in this area.
(0)

相关推荐