Converting dtype of column from str to S not working on reassignment #15575
Labels
Bug
Dtype Conversions
Unexpected or buggy dtype conversions
Duplicate Report
Duplicate issue or pull request
Code Sample, a copy-pastable example if possible
Output is:
Problem description
The new column has the correct dtype of numpy byte string, the old column no contains
the new values but still has dtype
object
.Expected Output
Both columns should have dtype 'S'
Output of
pd.show_versions()
df = pd.DataFrame({'a': ['Hello', 'World']})
df['a'] = df['a'].astype('S')
df['b'] = df['a'].astype('S')
print(df.dtypes)
The text was updated successfully, but these errors were encountered: