python,用于用mean填充缺少的值,请帮助我尝试此代码,但出现错误

dw1jzc5e  于 2021-08-20  发布在  Java
关注(0)|答案(0)|浏览(227)

df.loc[(数据['Perkotan'].isnull()==true),'Perkotan']=df['Perkotan'].mean()df.loc[(数据['Perdesan'].isnull()==true),'Perdesan']=df['Perdesan'].mean()
get_loc(self,key,method,tolerance)2897 try:->2898 return self.\u engine.get_loc(casted_key)2899中的keyerror回溯(最近一次调用)/usr/local/lib/python3.7/dist-packages/pandas/core/index/base.py
pandas/_libs/index.pyx在pandas中。_libs.index.indexengine.get_loc()
pandas/_libs/index.pyx在pandas中。_libs.index.indexengine.get_loc()
pandas/_libs/hashtable_class_helper.pxi在pandas._libs.hashtable.pyobjecthashtable.get_item()中
pandas/_libs/hashtable_class_helper.pxi在pandas._libs.hashtable.pyobjecthashtable.get_item()中
keyerror:“perkotaan”
上述异常是以下异常的直接原因:
get_loc(self,key,method,tolerance)2898返回self.get_loc(casted_key)2899除keyerror as err:->2900从err 2901 2902中提升keyerror(key),如果容差不是无:
keyerror:“perkotaan”

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题