<jupyter_start><jupyter_text>Shuffle Arrays in Unison A function for NumPy arrays in unison. > from mlxtend.preprocessing import shuffle_arrays_unison  Example 1 - Scaling a Pandas DataFrame<jupyter_code>import numpy as np
from mlxtend.preprocessing import shuffle_arrays_unison
X = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
y = np.array([1, 2, 3])
print('X:\n%s' % X)
print('y:\n%s' % y)
X2, y2 = shuffle_arrays_unison(arrays=[X, y], random_seed=3)
print('X2:\n%s' % X2)
print('y2:\n%s' % y2)<jupyter_output>X2:
[[4 5 6]
 [1 2 3]
 [7 8 9]]
y2:
[2 1 3]<jupyter_text>API<jupyter_code>with open('../../api_modules/mlxtend.preprocessing/shuffle_arrays_unison.md', 'r') as f:
    print(f.read())<jupyter_output>## shuffle_arrays_unison

*shuffle_arrays_unison(arrays, random_seed=None)*

Shuffle NumPy arrays in unison.

**Parameters**

- `arrays` : array-like, shape = [n_arrays]

    A list of NumPy arrays.

- `random_seed` : int (default: None)

    Sets the random state.

**Returns**

- `shuffled_arrays` : A list of NumPy arrays after shuffling.


**Examples**

    >>> import numpy as np
    >>> from mlxtend.preprocessing import shuffle_arrays_unison
    >>> X1 = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
    >>> y1 = np.array([1, 2, 3])
    >>> X2, y2 = shuffle_arrays_unison(arrays=[X1, y1], random_seed=3)
    >>> assert(X2.all() == np.array([[4, 5, 6], [1, 2, 3], [7, 8, 9]]).all())
    >>> assert(y2.all() == np.array([2, 1, 3]).all())
    >>>

For more usage examples, please see
[http://rasbt.github.io/mlxtend/user_guide/preprocessing/shuffle_arrays_unison/](http://rasbt.github.io/mlxtend/user_guide/preprocessing/shuffle_arrays_unison/)