Answers for "pandas how many non null columns"

1

how to count non null values in pandas

#Count non null values in a pandas dataframe
df.notnull().sum().sum()
Posted by: Guest on August-21-2021
0

How many columns have null values present in them? in pandas

import pandas as pd
df = pd.DataFrame({'a':[1,2,np.nan], 'b':[np.nan,1,np.nan],'c':[np.nan,2,np.nan], 'd':[np.nan,np.nan,np.nan]})
print(pd.isnull(df).sum())
Posted by: Guest on October-12-2021

Code answers related to "pandas how many non null columns"

Python Answers by Framework

Browse Popular Code Answers by Language