I tried running the code from lesson4-tabular and got an error on this line:
data = TabularDataBunch.from_df(path, train_df, valid_df, dep_var,
tfms=[FillMissing, Categorify], cat_names=cat_names)
Error is:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
in
2 cat_names = [‘workclass’, ‘education’, ‘marital-status’, ‘occupation’, ‘relationship’, ‘race’, ‘sex’, ‘native-country’]
3 data = TabularDataBunch.from_df(path, train_df, valid_df, dep_var,
----> 4 tfms=[FillMissing, Categorify], cat_names=cat_names)
~/miniconda3/envs/myenv/lib/python3.6/site-packages/fastai/tabular/data.py in from_df(cls, path, df, dep_var, valid_idx, procs, cat_names, cont_names, classes, **kwargs)
111 “Create a DataBunch
from train/valid/test dataframes.”
112 cat_names = ifnone(cat_names, [])
–> 113 cont_names = ifnone(cont_names, list(set(df)-set(cat_names)-{dep_var}))
114 procs = listify(procs)
115 return (TabularList.from_df(df, path=path, cat_names=cat_names, cont_names=cont_names, procs=procs)
~/miniconda3/envs/myenv/lib/python3.6/site-packages/pandas/core/generic.py in hash(self)
1490 def hash(self):
1491 raise TypeError(’{0!r} objects are mutable, thus they cannot be’
-> 1492 ’ hashed’.format(self.class.name))
1493
1494 def iter(self):
TypeError: ‘DataFrame’ objects are mutable, thus they cannot be hashed
Is there a way around this?
I’m using fast ai version 1.0.24