Last active
December 1, 2015 19:25
-
-
Save ansrivas/64f2b01386c59d7f5d30 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #use this to shuffle all the rows of pandas dataframe ( useful for some training algorithms ) | |
| import numpy as np | |
| import pandas as pd | |
| A = np.array([1, 2, 3]) | |
| B = np.array(['A', 'B', 'C']) | |
| df = pd.DataFrame({'col1':A, 'col2':B}) | |
| print df.head() | |
| print df.iloc[np.random.permutation(len(df))] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment