I have a list that starts with an "Empty DataFrame". When I tried to export this list with
to_csv
or to_excel
, a
"NoneType object has no attribute"
AttributeError results.
So I've tried
dfclean = [x for x in df if x]
which resulted in
'NoneType' object is not iterable TypeError
I've also tried
dfclean = [df for df in dfclean if not df.empty]
which resulted in
Name 'dfclean' is not defined NameError
I've also tried
dfclean = list(filter(lambda df: not df.empty, df))
which yielded the same
'NoneType' object is not iterable TypeError
In all these cases the output successfully displays the df result (a list that starts with EmptyDataFrame in the first line). Any suggestions to eliminate this Empty DataFrame, which presumably is the culprit for the NoneType errors above?