@@ -324,7 +324,7 @@ def scale_vars(df, mapper):
324324 df [mapper .transformed_names_ ] = mapper .transform (df )
325325 return mapper
326326
327- def proc_df (df , y_fld , skip_flds = None , do_scale = False , na_dict = None ,
327+ def proc_df (df , y_fld = None , skip_flds = None , do_scale = False , na_dict = None ,
328328 preproc_fn = None , max_n_cat = None , subset = None , mapper = None ):
329329
330330 """ proc_df takes a data frame df and splits off the response variable, and
@@ -419,8 +419,12 @@ def proc_df(df, y_fld, skip_flds=None, do_scale=False, na_dict=None,
419419 if subset : df = get_sample (df ,subset )
420420 df = df .copy ()
421421 if preproc_fn : preproc_fn (df )
422- y = df [y_fld ].values
423- df .drop (skip_flds + [y_fld ], axis = 1 , inplace = True )
422+ if y_fld is None : y = None
423+ else :
424+ numericalize (df , df [y_fld ], y_fld , None )
425+ y = df [y_fld ].values
426+ skip_flds += [y_fld ]
427+ df .drop (skip_flds , axis = 1 , inplace = True )
424428
425429 if na_dict is None : na_dict = {}
426430 for n ,c in df .items (): na_dict = fix_missing (df , c , n , na_dict )
0 commit comments