I want to check if a Pandas Dataframe row contains an empty set in a specific column, i.e.
d = {'col1': [1, 2], 'col2': [3, {}]}
df2 = pd.DataFrame(data=d)
col1 col2
0 1 3
1 2 {}
and then
df2['col_2_contains_empty_set'] = ? # how to implement this
should give
col1 col2 col_2_contains_empty_set
0 1 3 False
1 2 {} True
What's the correct way to do this? Can't do
bool(df['col2'])
or
df['col2'].bool()
as Series
are have ambiguous Boolean values, I think.