Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jorisvandenbossche opened this issue Dec 21, 2020 · 3 comments · Fixed by #38610
Closed

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

jorisvandenbossche opened this issue Dec 21, 2020 · 3 comments · Fixed by #38610
Labels
Regression Functionality that used to work in a prior pandas version
Milestone

Comments

@jorisvandenbossche
Copy link
Member

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

@jorisvandenbossche jorisvandenbossche added the Regression Functionality that used to work in a prior pandas version label Dec 21, 2020
@jorisvandenbossche jorisvandenbossche added this to the 1.3 milestone Dec 21, 2020
simonjayhawkins added a commit to simonjayhawkins/pandas that referenced this issue Dec 21, 2020
@simonjayhawkins
Copy link
Member

Possibly due to #38518 cc @jbrockmendel

can confirm, first bad commit: [7043f8f] REF: use astype_nansafe in Index.astype (#38518)

@simonjayhawkins
Copy link
Member

hit the revert button b4 becomes more difficult to revert.. #38610

@simonjayhawkins simonjayhawkins linked a pull request Dec 21, 2020 that will close this issue
@jbrockmendel
Copy link
Member

reverting makes sense short term.

longer-term, does this affect other places where astype_nansafe is called?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Regression Functionality that used to work in a prior pandas version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants