数据清洗是一项复杂且繁琐的工作,同时也是整个数据分析过程中最为重要的环节。
在python中空值被显示为NaN。首先,我们要构造一个包含NaN的DataFrame对象。
>>> import numpy as np
>>> import pandas as pd
>>> from pandas import Series,DataFrame
>>> from numpy import nan as NaN
>>> data = DataFrame([[12,'man','13865626962'],[19,'woman',NaN],[17,NaN,NaN],[NaN,NaN,NaN]],co
1