I have a data frame with some columns with empty lists and others with row lists:
donation_orgs donation_context 0 [] [] 1 [the research of Dr. ...] [In lieu of flowers , memorial donations ...]
I am trying to return a dataset without any rows where there are empty lists.
I tried just checking for null values:
dfnotnull = df[df.donation_orgs != []] dfnotnull
and
dfnotnull = df[df.notnull().any(axis=1)] pd.options.display.max_rows=500 dfnotnull
And I tried iterating over and checking existing values, but I think the lists do not return Null or None, as I thought they were:
dfnotnull = pd.DataFrame(columns=('donation_orgs', 'donation_context')) for i in range(0,len(df)): if df['donation_orgs'].iloc(i): dfnotnull.loc[i] = df.iloc[i]
All three of the above methods simply return each row in the original data frame. =
source share