Skip to content

first part of v2.0 changes #632

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 2 commits into from
Apr 6, 2023
Merged

first part of v2.0 changes #632

merged 2 commits into from
Apr 6, 2023

Conversation

Dr-Irv
Copy link
Collaborator

@Dr-Irv Dr-Irv commented Apr 5, 2023

For 2.0, a few ones since I had a little time:

  • The various numeric datetime attributes of DatetimeIndex (day, month, year etc.) were previously in of dtype int64, while they were int32 for arrays.DatetimeArray. They are now int32 on DatetimeIndex also
  • Level dtypes on Indexes from Series.sparse.from_coo() are now of dtype int32, the same as they are on the rows/cols on a scipy sparse matrix. Previously they were of dtype int64
  • Index cannot be instantiated using a float16 dtype. Previously instantiating an Index using dtype float16 resulted in a Float64Index with a float64 dtype.

@@ -73,7 +73,7 @@ class Index(IndexOpsMixin, PandasObject):
def __new__(
cls,
data: Iterable,
dtype: Literal["int"] | type_t[int] | type_t[np.int_],
dtype: Literal["int"] | type_t[int] | type_t[np.int_] | type_t[np.uint],
Copy link
Member

Choose a reason for hiding this comment

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

could probably combine the two numpy types into type_t[np.integer] https://numpy.org/doc/stable/reference/arrays.scalars.html#scalars

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

OK, I've made that change and added tests. Note that it would be ideal to reject invalid dtype values (e.g. np.float16), but we can only do that once we enumerate all the possible dtype values for the constructor. I left in the test for np.float16 with a comment that we will have to address that later.

@twoertwein twoertwein merged commit 5fed9c2 into pandas-dev:main Apr 6, 2023
@twoertwein
Copy link
Member

Thanks @Dr-Irv (sorry, i will not have much time the next two weeks to help much with the changes for 2.0)

@Dr-Irv Dr-Irv deleted the v2.0chgs_1 branch December 2, 2024 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants