Fix Python – Random row selection in Pandas dataframe

Is there a way to select random rows from a DataFrame in Pandas.
In R, using the car package, there is a useful function some(x, n) which is similar to head but selects, in this example, 10 rows at random from x.
I have also looked at the slicing documentation and there seems to be nothing equivalent.
Now using version 20. There is a sample….

Fix Python – Better way to shuffle two numpy arrays in unison

I have two numpy arrays of different shapes, but with the same length (leading dimension). I want to shuffle each of them, such that corresponding elements continue to correspond — i.e. shuffle them in unison with respect to their leading indices.
This code works, and illustrates my goals:
def shuffle_in_unison(a, b):
assert len(a) == len(b)