Skip to content

Instantly share code, notes, and snippets.

@nomeyer
Last active March 13, 2016 21:03
Show Gist options
  • Save nomeyer/b50bf167de4054e6b479 to your computer and use it in GitHub Desktop.
Save nomeyer/b50bf167de4054e6b479 to your computer and use it in GitHub Desktop.
import pandas
df = pandas.DataFrame(data)
# Randomly sample 70% of your dataframe
df_0.7 = df.sample(frac=0.7)
# Randomly sample 7 elements from your dataframe
df_7 = df.sample(n=7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment