The Python Book
null none

'Null' value in Python is 'None'

There's always only one instance of this object, so you can check for equivalence with x is None (identity comparison) instead of x == None

Missing data in Python

Roughly speaking:

  • missing 'object' -> None
  • missing numerical value ->Nan ( np.nan )

Pandas handles both nearly interchangeably, converting if needed.

  • isnull(), notnull() generates boolean mask indicating missing (or not) values
  • dropna() return filtered version of data
  • fillna() impute the missing values

More detail:

Notes by Willem Moors. Generated on momo:/home/willem/sync/20151223_datamungingninja/pythonbook at 2019-07-31 19:22