Skip to content

Instantly share code, notes, and snippets.

@alexrutherford
Created April 20, 2018 18:57
Show Gist options
  • Save alexrutherford/e81e9558b1fd019c6988b35379ca51f7 to your computer and use it in GitHub Desktop.
Save alexrutherford/e81e9558b1fd019c6988b35379ca51f7 to your computer and use it in GitHub Desktop.
import sklearn.model_selection
import pandas as pd
df = pd.DataFrame(data={'A':[1,2,3],'B':[4,5,6],'C':[1,0,1]})
res = sklearn.model_selection.train_test_split(df[['A','B']],df['C'])
# Returns 4 things
res[0].shape
# (2,2)
res[1].shape
# (1,2)
res[2].shape
# (2,)
res[3].shape
# (1,)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment