Assume, I have a Pandas DataFrame as following:
| 0 | 1 | 2 | 3 |
|-----:|----:|----:|----:|
| 1115 | nan | "YE"| nan |
| 1590 | nan | "He"| "NO"|
How can I rearrange such a DataFrame consisting of over 100 columns and rows, that the nan
values are shifted to the right side and the real values to the left side:
Desired output:
| 0 | 1 | 2 | 3 |
|-----:|----:|----:|----:|
| 1115 | "YE"| nan | nan |
| 1590 | "HE"| "NO"| nan |
Note: this should also work for an arbitrary number of columns and rows.