xxxxxxxxxx
import pandas as pd
## df1 as an example data frame
## col1 name of column for which you want to calculate the nan values
sum(pd.isnull(df1['col1']))
xxxxxxxxxx
#Python, pandas
#Count missing values for each column of the dataframe df
df.isnull().sum()
xxxxxxxxxx
np.count_nonzero(df.isnull().values)
np.count_nonzero(df.isnull()) # also works