If I have an array with nan, which looks like this:
array([[ 0., 0., 0., 0.],
[ 0., 0., nan, nan],
[ 0., 1., 3., nan],
[ 0., 2., 4., 7.],
[ 0., nan, 2., nan],
[ 0., 4., nan, nan]])
how can I shift all the nans to the start of the array, without changing the shape? Some thing like this:
array([[ 0., 0., 0., 0.],
[ nan, nan, 0., 0.],
[ nan, 0., 1., 3.],
[ 0., 2., 4., 7.],
[ nan, nan, 0., 2.],
[ nan, nan, 0., 4.]])