def sort_matrix ( a , n = 0 ) : a = _n . array ( a ) return a [ : , a [ n , : ] . argsort ( ) ]
reorder dimensions of a matrix python
This will rearrange the array a [ n ] from lowest to highest and rearrange the rest of a [ i ] s in the same way . It is dumb and slow .
def sort_matrix(a,n=0):
    """
    This will rearrange the array a[n] from lowest to highest, and
    rearrange the rest of a[i]'s in the same way. It is dumb and slow.

    Returns a numpy array.
    """
    a = _n.array(a)
    return a[:,a[n,:].argsort()]