when doing cat_column.cat.codes you get the codes of the categories.
the problem - is that it's pandas categories and not ours.
e.g.
psychological_and_social_health / health_mental_past_psychiatrist -
health_mental_past_psychiatrist
No 14317
Yes 2407
Prefer not to answer 93
Do not know 35
with preferred_language='coding' it's
health_mental_past_psychiatrist
0 14317
1 2407
-3 93
-1 35
but with .cat.codes we get
1 14317
3 2407
-1 138
2 93
0 35
preferred_language is working - but this might cause people to create some mistakes. fixing it is non-trivial since you can't control the pandas coding scheme.
when doing cat_column.cat.codes you get the codes of the categories.
the problem - is that it's pandas categories and not ours.
e.g.
psychological_and_social_health / health_mental_past_psychiatrist -
health_mental_past_psychiatrist
No 14317
Yes 2407
Prefer not to answer 93
Do not know 35
with preferred_language='coding' it's
health_mental_past_psychiatrist
0 14317
1 2407
-3 93
-1 35
but with .cat.codes we get
1 14317
3 2407
-1 138
2 93
0 35
preferred_language is working - but this might cause people to create some mistakes. fixing it is non-trivial since you can't control the pandas coding scheme.