Skip to content

Commit ff55ee3

Browse files
Merge branch 'master' into cuml2
2 parents 385309b + 7a995c2 commit ff55ee3

File tree

11 files changed

+33870
-14
lines changed

11 files changed

+33870
-14
lines changed

data_science_tools/blob_datapane.ipynb

Lines changed: 552 additions & 0 deletions
Large diffs are not rendered by default.

data_science_tools/faker.ipynb

Lines changed: 1100 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import numpy as np
2+
import pandas as pd
3+
from sklearn.model_selection import train_test_split
4+
from sklearn.model_selection import StratifiedShuffleSplit
5+
6+
suicide = pd.read_csv('master.csv')
7+
8+
suicide[' gdp_for_year ($) ']= suicide[' gdp_for_year ($) '].apply(lambda val: val.replace(',', ''))
9+
suicide[' gdp_for_year ($) '] = pd.to_numeric(suicide[' gdp_for_year ($) '])
10+
11+
train, test = train_test_split(suicide, test_size=0.2, random_state = 1)
12+
13+
split = StratifiedShuffleSplit(n_splits=1, test_size=0.2, random_state = 1)
14+
for train_index, test_index in split.split(suicide, suicide['generation']):
15+
strat_train = suicide.loc[train_index]
16+
strat_test = suicide.loc[test_index]
17+

0 commit comments

Comments
 (0)