Pandas fill in missing values

Is filled with objects: DataFrame

 

A number or a character string to fill

  df.fillna (0) or df.fillna ( ',') 

2 is filled with data prior to a 

  df.fillna( method = 'pad') 

3 is filled with a data

  df.fillna(method='bfill',limit=1)    

  With restrictions limit the number of possible alternative NaN each column, let's limit can only replace a NaN each column

4 using the average or other descriptive statistics replace missing values

  df.fillna( df.mean() ) 

5 select which column of data is processed missing values

  df.fillna( df.mean()['one','two'] )

Guess you like

Origin www.cnblogs.com/chenxiyuxiao/p/11571006.html