df_masked.loc[:, col] = df_masked.groupby([df_masked.index.month, df_masked.index.day])[col].\
transform(lambda y: y.fillna(y.median()))
即使在使用.loc后,我也得到了foll。错误,我该如何解决它?即使在熊猫中使用.loc后也得到SettingWithCopyWarning警告
Anaconda\lib\site-packages\pandas\core\indexing.py:476: 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
self.obj[item] = s
我无法重现此问题。你的Pandas版本是什么?您可能还想创建[mcve]。 – Evert