Quite similar to the question here
Having a dataframe
COL_A ... COL G ... COL N
0 NaN ... Nan ... wds
1 NaN ... Nan ... dst
2 ds ... Nan ... NaN
3 NaN ... Nan ... NaN
I would like to extract list of lists (or numpy array , dont mind) as following:
l = [['wds'],['dst],['dst'] , [] ] ,i.e
len(l) == df.shape[0]
When trying things like :
df.stack().groupby(level=0).apply(list).tolist()
Out[]: [['wds'],['dst'],['dst']]
The all-nan rows are being removed.