I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the master branch of pandas.
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:
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']})
df = df.convert_dtypes()
pd.get_dummies(df)
But if I will change the df.convert_dtypes()
to df.convert_dtypes(convert_string=False)
it will work as expected.
Why is this happening? Is it a bug?
pandas pd.get_dummies()
should work on strings columns dtype also.
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4