Skip to content

REGR: astype(str) of object array with byte objects #38607

Closed
@jorisvandenbossche

Description

@jorisvandenbossche

On released version, we see this behaviour:

In [1]: idx = pd.Index(['あ', b'a'], dtype='object')

In [2]: idx
Out[2]: Index(['あ', b'a'], dtype='object')

In [4]: idx.astype(str)
Out[4]: Index(['あ', 'a'], dtype='object')

So where the bytes object b"a" gets converted to the string "a".

On master (since a few days), however, we now get:

In [7]: idx.astype(str)
Out[7]: Index(['あ', 'b'a''], dtype='object')

so where the bytes object gets converted to the string "b'a'"

Possibly due to #38518 cc @jbrockmendel

Metadata

Metadata

Assignees

No one assigned

    Labels

    RegressionFunctionality that used to work in a prior pandas version

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions