进行下面计算
df['已完成'] = df['已完成'] / 10000
df['未完成'] = df['未完成'] / 10000
运行警告:
大概意思是在DataFrame复制切片上设置值导致这个报错,类似word副本不允许编辑
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: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
df['已完成'] = df['已完成'] / 10000
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: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
df['未完成'] = df['未完成'] / 10000
解决方法:
用pd.DataFrame()方法格式化下这个副本数据
df= pd.DataFrame(df)
df['已完成'] = df['已完成'] / 10000
df['未完成'] = df['未完成'] / 10000