Open ganbaaelmer opened 2 months ago
Thanks for the report. Currently str
uses NumPy object dtypes. But this is an area of pandas that is under active development and will change in the future. See https://pandas.pydata.org/pdeps/0014-string-dtype.html for more details. You can enable it by using pd.options.future.infer_string = True
:
pd.options.future.infer_string = True
ser = pd.Series(["a", "b", None])
print(ser.astype("str").dtype)
# str
@jorisvandenbossche - I'm seeing the following:
pd.options.future.infer_string = True
ser = pd.Series(["a", "b", None])
print(ser.astype(str).dtype)
# object
Is that expected to be object dtype?
i think this one is working
pd.options.future.infer_string = True
df[column_A] = df[column_A].astype('str')
Pandas version checks
[X] I have checked that this issue has not already been reported.
[X] I have confirmed this bug exists on the latest version of pandas.
[X] I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
astype(str) not working
Expected Behavior
object to str not working. dtype still object
Installed Versions