Pandas 索引数据帧

Pandas 索引数据帧,pandas,indexing,Pandas,Indexing,我正在设置复制警告: 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 这是我的数据帧(容量): 我想根据日期更改属于A列的特定值。我的意思是,如果指数的月份是3并且大于

我正在设置复制警告:

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
这是我的数据帧(容量):

我想根据日期更改属于A列的特定值。我的意思是,如果指数的月份是3并且大于3,那么将值15改为20.40

Capacity['A'][(Capacity.index.month >= 3)] = 20.40
如何写这行代码以避免收到警告?

用于
数据帧的设置值,而不是
系列

Capacity.loc[(Capacity.index.month >= 3), 'A'] = 20.40
有关详细信息,请参见。

用于
数据帧的设置值,而不是
系列

Capacity.loc[(Capacity.index.month >= 3), 'A'] = 20.40
更多信息请参阅