我有这样的系列。 (ser)
0 2019-01-01 09:20:00-04:00
1 2019-01-02 09:20:00-04:00
2 2019-01-03 09:20:00-04:00
3 2019-01-04 09:20:00-04:00
4 2019-01-05 09:20:00-04:00
另一个这样。 (new_ser)
2 2019-01-01 09:55:11-05:00
另一个这样。 (mask_new_ser)
0 False
1 False
2 True
3 False
4 False
我正在尝试获得这样的最终系列:
0 2019-01-01 09:20:00-04:00
1 2019-01-02 09:20:00-04:00
2 2019-01-01 09:55:11-05:00
3 2019-01-04 09:20:00-04:00
4 2019-01-05 09:20:00-04:00
使用下面的行可以正常工作。
ser[mask_new_ser.index] = new_ser[mask_new_ser.index]
但是我收到以下警告:
SettingWithCopyWarning: modifications to a method of a datetimelike object are not supported and are discarded. Change values on the original.
self._setitem_with_indexer(indexer, value)
我该如何纠正?
用途:
ser.loc[new_ser.index] = new_ser
print (ser)
0 2019-01-01 09:20:00-04:00
1 2019-01-02 09:20:00-04:00
2 2019-01-01 09:55:11-05:00
3 2019-01-04 09:20:00-04:00
4 2019-01-05 09:20:00-04:00
Name: a, dtype: object