Determining missing values in a dataframe

During data preprocessing, it is a common task to determine the number of missing values in each column. The following code will produce a CSV file containing the number of missing values in each column of a dataframe. The name of the dataframe is 'df'.

The python file can be downloaded from here.

Determining number of missing values in a dataframe

#*****************************************************************#
# Determining missing values in a dataframe
# Version 1
# Date: 21 March 2019
#*****************************************************************#
import pandas as pd
dfMissingInfo = df[df.columns[df.isnull().any()]].isnull().sum()
dfMissingInfo.to_csv("dfMissingInfo.csv", header = False)