REGR: change in Series.astype(str) behavior for None · Issue #36904 · pandas-dev/pandas (original) (raw)

Question about pandas

Let's say we have a Series with None like the below.

pser = pd.Series(["hi", "hi ", " ", " \t", "", None], name="x")

print(pser) 0 hi 1 hi 2 3 \t 4 5 None Name: x, dtype: object

the last value is None, but it is casted to nan after using astype with str parameter.

print(pser.astype(str)) 0 hi 1 hi 2 3 \t 4 5 nan Name: x, dtype: object

Is it intended behavior in pandas 1.1.1. ??

Thanks :)