I have a dataframe which has multiple columns. I'd like to iterate through the columns, counting for each column how many null values there are and produce a new dataframe which displays the sum of isnull
values alongside the column header names.
If I do:
for col in main_df:
print(sum(pd.isnull(data[col])))
I get a list of the null count for each column:
0
1
100
What I'm trying to do is create a new dataframe which has the column header alongside the null count, e.g.
col1 | 0
col2 | 1
col3 | 100