Forgive me if the title a little bit confusing.
Assuming I have test.h5. Below is the result of reading this file using df.read_hdf('test.h5', 'testdata')
0 1 2 3 4 5 6
0 123 444 111 321 NaN NaN NaN
1 12 234 113 67 21 32 900
3 212 112 543 321 45 NaN NaN
I want to select the last non-Nan column. My expected result is like this
0 321
1 900
2 45
Also I want to select all column except the last non-NaN column. My expected result perhaps is like this. It might can be in numpy array but I have not foud any solution yet.
0 1 2 3 4 5 6
0 123 444 111
1 12 234 113 67 21 32
3 212 112 543 321
I searched online and found df.iloc[:, :-1] for reading all column but the last one and df.iloc[:, -1] for reading the last column.
My current result using these 2 command is like this: 1. for reading all column except the last one
0 1 2 3 4 5
0 123 444 111 321 NaN NaN
1 12 234 113 67 21 32
3 212 112 543 321 45 NaN
2.for reading the last column
0 NaN
1 900
2 Nan
My question is, is there any command or query used in pandas to address these condition?
Thank you for any help and suggestion.