Skip to content

REGR: change in Series.astype(str) behavior for None #36904

Closed
@itholic

Description

@itholic

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 :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    RegressionFunctionality that used to work in a prior pandas versionStringsString extension data type and string data

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions