I have the following dataframe:
df = pd.DataFrame({'a': [6.6, -5.2, 2.1, 3.3, 1.1],
'b': ['a', 'a', 'c', 'b', 'a'],
'c': ['kfr', 'kfr', 'lu', 'ku', 'lu'],
'd': ['t', 's', 's', 't', 'a']})
All the dtypes (columns b, c, d) are of type string.
If I call df = df.convert_dtypes()
, and then call pd.get_dummies()
, nothing happens.
But when I call it on just one column of the dataframe, it works.
Why is this happening? Is it a bug?
CodePudding user response:
After some investigation, I have no idea why this might be occurring, especially since it works for single columns. I'm guessing it's a bug, because there seem to be quite a few of them centered around the pd.NA
type (which convert_dtypes
is in support of.)
I recommend opening a bug report at https://github.com/pandas/pandas-dev.