2019-04-30
阅读量:
333
pandas如何处理丢失的数据
删除丢失的数据:
考虑这是由以下代码生成的DataFrame:

import pandas as pd
# Create a DataFrame
dframe = pd.DataFrame({'Geeks': [23, 24, 22],
'For': [10, 12, np.nan],
'geeks': [0, np.nan, np.nan]},
columns =['Geeks', 'For', 'geeks'])
# This will remove all the
# rows with NAN values
# If axis is not defined then
# it is along rows i.e. axis = 0
dframe.dropna(inplace = True)
print(dframe)
# if axis is equal to 1
dframe.dropna(axis = 1, inplace = True)
print(dframe)






评论(0)


暂无数据
推荐帖子
0条评论
0条评论
0条评论