I tried creating a separate models for smokers and non smokers by repeating the steps given. I thought by using only the non_smoker_df i could repeat the same steps by changing the sex columns to 0 and 1 and also one hot encode the region column. Since non_smoker_df was already made i tried making that ‘no’ into 0 and i get this error. Is the error because the non_smoker_df is not actually a data frame ?
non_smoker_df[smoker_value] = non_smoker_df.smoker.map(smoker_value)
TypeError Traceback (most recent call last)
----> 2 non_smoker_df[smoker_value] = non_smoker_df.smoker.map(smoker_value)
/usr/local/lib/python3.7/dist-packages/pandas/core/indexes/base.py in contains(self, key)
→ 4074 hash(key)
4076 return key in self._engine
TypeError: unhashable type: ‘dict’