Reputation:
How to find the percentage of null value in a pandas dataframe?
Null_Values=np.sum(data.isnull())
Null_Values/len(Null_Values)
Upvotes: 1
Views: 8393
Reputation: 30991
data.isnull().sum() gives the number of NaN values in each column separately.
To compute the share of NaNs in the whole DataFrame, run:
data.isnull().sum().sum()/len(data)
Alternative solution:
np.count_nonzero(data.isna()) / data.size
Upvotes: 1
Reputation: 13387
This should work:
NullValues=data.isnull().sum()/len(data)
Upvotes: 0