I have a dataframe with test_num
as index:
file_num 6 7
test_num
79 NaN ↑
148 ↑ NaN
I need to reduce it to keep a first available direction (arrow) for any file_num
:
direction
test_num
79 ↑
148 ↑
I've tried this:
fd.agg(lambda x: [a for a in x if a][0], axis=1)
test_num
79 NaN
148 ↑
fd.agg(lambda x: [a for a in x if a != pd.np.nan][0], axis=1)
test_num
79 NaN
148 ↑
How to do what I need here?