I have a dataframe that has some null values in different columns. I want to create a list from that dataframe 'data' where I can see only the columns that have non null values. Also I have created a list of missing_row_counts that include the number of null values that each column has. Here is the code that I have.
def non_zeros(series):
"""Returns a list of the index values in series for which
the value is greater than 0.
"""
for i in missing_row_counts:
nonzero_row = i > 0 #need to fix
return nonzero_row
the code above runs but when I call it with: missing_cols = non_zeros(missing_row_counts) missing_cols it returns True where I am expecting a list of columns that have values all their columns