我尝试根据现有列在pandas数据框中设置索引
df具有col1,col2,col3,col4。 我写道:
df = df.set_index(['col1','col2','col3'], drop=False, inplace=True)
我得到:
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
如果只是警告,我会没事的,但是我什至无法访问df。
df.shape:
'NoneType' object has no attribute 'shape'