To extract all the data from a column containing an empty list, you can filter out rows in DataFrame by using lambda function.
import pandas as pd
sample_data={
‘col’:[ [ ], [ “X”, “Y”], [ ], [“Z] ]
}
df=pd.DataFrame(sample_data)
filtered_data= df[ df[‘col’ ].apply(lambda x: len(x)>0) ]
print(filtered_data)
This will filter out the empty list and output will be:
col
1 [X,Y]
3 [Z]