REGR: astype(str) of object array with byte objects · Issue #38607 · pandas-dev/pandas (original) (raw)

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