BUG: Nested sort with NaN · Issue #3917 · pandas-dev/pandas (original) (raw)

Nested sort doesn't seem to work with NaNs, see this SO question.

In [11]: df
Out[11]:
    a   b
0   1   9
1   2 NaN
2 NaN   5
3   1   2
4   6   5
5   8   4
6   4   5

In [12]: df.sort(columns=["a","b"])
Out[12]:
    a   b
3   1   2
0   1   9
1   2 NaN
2 NaN   5
6   4   5
4   6   5
5   8   4

(It works as expected using a single columns)