I have a dataframe like this [![Dataframe looks like this][1]: https://i.stack.imgur.com/R7GmM.png Now I want to skip nan's and so that data shift towards left i.e. [![formatted dataframe should be like this] [1]: https://i.stack.imgur.com/yGYIy.png
I am not able to do it via pandas. Is a scalable solution possible for this if I have a large dataset of let say 100k rows?
[EDIT]: Here is the data and desired output:
#Original df
>>> df
A B C D
0 a NaN c NaN
1 b NaN b a
2 c NaN NaN d
3 d a b c
#Desired output:
A B C D
0 a c
1 b b a
2 c d
3 d a b c