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

API: Deprecate Index.is_(boolean|categorical|integer|floating|numeric|object|interval) #50042

Closed
8 of 10 tasks
topper-123 opened this issue Dec 3, 2022 · 23 comments
Closed
8 of 10 tasks
Assignees
Labels
API - Consistency Internal Consistency of API/Behavior Deprecate Functionality to remove in pandas good first issue Index Related to the Index class or subclasses

Comments

@topper-123
Copy link
Contributor

topper-123 commented Dec 3, 2022

Feature Type

  • Adding new functionality to pandas

  • Changing existing functionality in pandas

  • Removing existing functionality in pandas

Problem Description

I propose deprecating the mentioned methods on Index.

I suggest dtype checking should be the same for indexes, series and arrays, so e.g. if users want to check the dtype of an index they should use the functions in pandas.api.types, e.g. for numeric dtype checks, do pd.api.types.is_numeric_dtype(idx).

Feature Description

Deprecate the mentioned methods and make users use the functions they'd use for series, i.e. the dtype checking functions in pandas.api.types.

Alternative Solutions

The alternative is not deprecating the methods...

Methods to deprecate:

@topper-123 topper-123 added Enhancement Needs Triage Issue that has not been reviewed by a pandas team member labels Dec 3, 2022
@phofl phofl changed the title API: Deprevate Index.is_(boolean|categorical|integer|floating|numeric|object|interval) API: Deprecate Index.is_(boolean|categorical|integer|floating|numeric|object|interval) Dec 4, 2022
@jbrockmendel
Copy link
Member

+1

@lithomas1 lithomas1 added Deprecate Functionality to remove in pandas Index Related to the Index class or subclasses API - Consistency Internal Consistency of API/Behavior and removed Enhancement Needs Triage Issue that has not been reviewed by a pandas team member labels Dec 8, 2022
@topper-123
Copy link
Contributor Author

take

@topper-123
Copy link
Contributor Author

I've started working on this, one method at a time.

This issue is quite beginner friendly, so If someone wants to join in, they're welcome and I can guide you through it.

@ShisuiUzumaki
Copy link
Contributor

@topper-123 I am interested in this issue. Could you guide m on how to take it?

@topper-123
Copy link
Contributor Author

topper-123 commented Dec 11, 2022

hi @ShisuiUzumaki, great. You could for example start with deprecating Index.is_interval and after thatIndex.is_categorical?

For a template how to do it, see #50176, where I've deprecated Index.is_boolean.

@topper-123
Copy link
Contributor Author

I don’t know if the above is sufficient information, but if you’ve got any questions, just get back to me.

@ShisuiUzumaki
Copy link
Contributor

Okay, thanks. I will start working on it and will connect with you if need any guidance.

@yuuun
Copy link
Contributor

yuuun commented Dec 13, 2022

This is the first time for joining the issue. I think this will be a good practice for me. Can I have a try?

@bang128
Copy link
Contributor

bang128 commented Dec 13, 2022

I am also looking for a good first issue to work on. Is there anything I can help for this issue?

@topper-123
Copy link
Contributor Author

@yuuun , you could take is_floating and @bang128 you could take is_object.

is_numeric may be a bit more complex (it’s treatment of complex numbers and booleans may differ from types.api.is_numeric), but if someone wants to take it, just ping me and I can guide you.

@yuuun
Copy link
Contributor

yuuun commented Dec 13, 2022

take

@topper-123
Copy link
Contributor Author

great, I see you've started the PRs. Ping me when you're ready for feedback.

@jbrockmendel
Copy link
Member

@topper-123 one that will be more difficult (i.e. NOT a good first issue) but that i would find very nice is getting rid of holds_integer.

@topper-123
Copy link
Contributor Author

@jbrockmendel , yeah I can take that.

@topper-123
Copy link
Contributor Author

Anyone up for taking on is_object & is_numeric?

is_numeric is a bit more complex than the other as I mention above, but is still doable and is a good learning experience.

@ABCPAN-rank
Copy link
Contributor

@topper-123 I'm interested in this issue. Can i try to deprecate is_object ?

@topper-123
Copy link
Contributor Author

Yes! Ping me when the PR is ready for review.

@topper-123
Copy link
Contributor Author

@ABCPAN-rank, we had a PR for is_object already (#50227), that just wasn't listed in the original comment at the time when I answered you. Are you up for trying is_numeric (it's a bit more difficult)?

@ABCPAN-rank
Copy link
Contributor

@topper-123 yes,i can try it. When index include complex or bool , is_numeric will output flase and is_numeric_dtype will output True . Dose this mean i should change is_numeric_dtype?

@topper-123
Copy link
Contributor Author

is_numeric_dtype should not be changed. Just use is_numeric_dtype as-is, and add use of is_bool_dtype, is_complex_dtype as needed.

@ABCPAN-rank
Copy link
Contributor

Do you mean i can use is_numeric_dtype(idx) and not is_bool_dtype(idx) and not is_complex_dtype(idx) instead of idx.is_numeric() ?

@topper-123
Copy link
Contributor Author

Yes, where it's needed. There may also be places where it's ok to pass complex numbers and booleans.

@topper-123
Copy link
Contributor Author

Closing as completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API - Consistency Internal Consistency of API/Behavior Deprecate Functionality to remove in pandas good first issue Index Related to the Index class or subclasses
Projects
None yet
Development

No branches or pull requests

7 participants