The Python Book
 
null none
20151012

'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

stackoverflow.com/questions/3289601/null-object-in-python

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: jakevdp.github.io/PythonDataScienceHandbook/03.04-missing-values.html

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