I have a pandas dataframe df
which looks as following:
0 1 2 3 4 5 6
0 3 74
1 4 2
2 -9
3 -1 2 -16 -21
4 1
5 28
I want to remove all the nan
from the above and realign the data in each row to get the following:
0 1 2 3
0 3 74
1 4 2
2 -9
3 -1 2 -16 -21
4 1
5 28
Basically I am trying to left align all the data in each row after removing nan
. I am not sure how to proceed with this.