I have the following pandas dataframe:
Col
0 []
1 []
2 [(foo, bar), (foo, bar)]
3 []
4 []
5 []
6 []
7 [(foo, bar), (foo, bar)]
I would like to remove all the empty lists (*):
Col
2 [(foo, bar), (foo, bar)]
7 [(foo, bar), (foo, bar)]
For the above I tried:
df = df.loc[df.Col != '[]']
df
and
df.pipe(lambda d: d[d['Col'] != '[]'])
However, none of them worked. So, my question is how can I remove all the empty lists from the dataframe like (*)?.