File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -18,11 +18,7 @@ def load_finches_1975():
1818
1919def load_finches (path ):
2020 # Load the data
21- df = pd .read_csv (path )
22-
23- # Data cleaning methods. This is provided for you. Follow along the annotations
24- # to learn what's going on.
25- df = (jn .DataFrame (df ) # wrap dataframe in a Janitor dataframe.
21+ df = (pd .read_csv (path )
2622 .clean_names () # clean column names
2723 .rename_column ('blength' , 'beak_length' ) # rename blength to beak_length (readability fix)
2824 .rename_column ('bdepth' , 'beak_depth' ) # rename bdepth to beak_depth (readability fix)
@@ -43,15 +39,20 @@ def load_baseball():
4339
4440
4541def load_sterilization ():
46- df = pd .read_csv ('../data/sterilization.csv' , na_filter = True , na_values = ['#DIV/0!' ])
47- df = jn .DataFrame (df ).clean_names ().label_encode ('treatment' )
42+ df = (
43+ pd .read_csv ('../data/sterilization.csv' , na_filter = True , na_values = ['#DIV/0!' ])
44+ .clean_names ()
45+ .label_encode ('treatment' )
46+ )
4847 mapping = dict (zip (df ['treatment' ], df ['treatment_enc' ]))
4948 return df , mapping
5049
5150
5251def load_kruschke ():
53- df = pd .read_csv ('../data/iq.csv' , index_col = 0 ) # comment out the path to the file for students.
54- df = jn .DataFrame (df ).label_encode ('treatment' )
52+ df = (
53+ pd .read_csv ('../data/iq.csv' , index_col = 0 ) # comment out the path to the file for students.
54+ .label_encode ('treatment' )
55+ )
5556 return df
5657
5758
You can’t perform that action at this time.
0 commit comments