Skip to content
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

BUG: SparseDtype requires numpy dtype #53160

Merged
merged 2 commits into from
May 11, 2023

Conversation

jbrockmendel
Copy link
Member

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added type annotations to new arguments/methods/functions.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.

@mroeschke
Copy link
Member

Seems like a user was relying on passing a sparse categorical type, does it mean it needs deprecating? #49987

@mroeschke mroeschke added the Sparse Sparse Data Type label May 10, 2023
@jbrockmendel
Copy link
Member Author

Seems like a user was relying on passing a sparse categorical type, does it mean it needs deprecating? #49987

They were, but then it would silently give them an unwanted cast to Sparse[object]

df = pd.DataFrame([["a", 0],["b", 1], ["b", 2]], columns=["A","B"])
>>> df["A"].astype(SparseDtype("category"))
Sparse[object, nan]

@mroeschke mroeschke added this to the 2.1 milestone May 11, 2023
@mroeschke mroeschke merged commit 2251902 into pandas-dev:main May 11, 2023
@mroeschke
Copy link
Member

Thanks @jbrockmendel

@jbrockmendel jbrockmendel deleted the depr-sparse-cat branch May 11, 2023 01:55
Rylie-W pushed a commit to Rylie-W/pandas that referenced this pull request May 19, 2023
* BUG: SparseDtype requires numpy dtype

* GH ref
Daquisu pushed a commit to Daquisu/pandas that referenced this pull request Jul 8, 2023
* BUG: SparseDtype requires numpy dtype

* GH ref
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Sparse Sparse Data Type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants