Skip to content

REGR: undocumented astype("category").astype(str) type inconsistency between pandas 1.1 & 1.2 #42087

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

Merged
merged 4 commits into from
Jun 21, 2021

Conversation

simonjayhawkins
Copy link
Member

@simonjayhawkins simonjayhawkins added the Categorical Categorical Data Type label Jun 17, 2021
@simonjayhawkins simonjayhawkins added this to the 1.2.5 milestone Jun 17, 2021
@@ -523,14 +523,17 @@ def astype(self, dtype: Dtype, copy: bool = True) -> ArrayLike:
try:
new_cats = np.asarray(self.categories)
new_cats = new_cats.astype(dtype=dtype, copy=copy)
fill_value = np.array(np.nan).astype(dtype).item()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are cases where .item() has weird behavior and we use lib.item_from_zerodim instead. no idea if any of those cases are reachable here

@jreback jreback merged commit 817b25a into pandas-dev:master Jun 21, 2021
@jreback
Copy link
Contributor

jreback commented Jun 21, 2021

thanks @simonjayhawkins

@lumberbot-app

This comment has been minimized.

@jreback
Copy link
Contributor

jreback commented Jun 21, 2021

@meeseeksdev backport 1.2.x

@jreback
Copy link
Contributor

jreback commented Jun 21, 2021

@meeseeksdev backport 1.3.x

@lumberbot-app

This comment has been minimized.

@jreback
Copy link
Contributor

jreback commented Jun 21, 2021

cc @simonjayhawkins attempted backport to 1.2.x & 1.3.x

@simonjayhawkins
Copy link
Member Author

cc @simonjayhawkins attempted backport to 1.2.x & 1.3.x

1.3.x backport ok, 1.2.x needs manual. will do shortly.

@simonjayhawkins simonjayhawkins deleted the category-astype-str branch June 21, 2021 13:15
jreback pushed a commit that referenced this pull request Jun 21, 2021
… type inconsistency between pandas 1.1 & 1.2 (#42157)

Co-authored-by: Simon Hawkins <[email protected]>
simonjayhawkins added a commit to simonjayhawkins/pandas that referenced this pull request Jun 21, 2021
…stype(str) type inconsistency between pandas 1.1 & 1.2
simonjayhawkins added a commit that referenced this pull request Jun 21, 2021
… type inconsistency between pandas 1.1 & 1.2 (#42165)
neinkeinkaffee pushed a commit to neinkeinkaffee/pandas that referenced this pull request Jun 21, 2021
JulianWgs pushed a commit to JulianWgs/pandas that referenced this pull request Jul 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Categorical Categorical Data Type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: undocumented astype("category").astype(str) type inconsistency between pandas 1.1 & 1.2
3 participants