Feature Type
-
[ ] Adding new functionality to pandas
-
[ ] Changing existing functionality in pandas
-
[X] 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:
- [x] is_boolean (PR: #50176)
- [x] is_integer (PR: #50178)
- [x] is_floating (PR: #50235)
- [x] is_numeric (PR: #50769)
- [x] is_object (PR: #50227)
- [x] is_categorical (PR: #50225)
- [x] is_interval (PR: #50196)
Comment From: jbrockmendel
+1
Comment From: topper-123
take
Comment From: topper-123
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.
Comment From: ShisuiUzumaki
@topper-123 I am interested in this issue. Could you guide m on how to take it?
Comment From: topper-123
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
.
Comment From: topper-123
I don’t know if the above is sufficient information, but if you’ve got any questions, just get back to me.
Comment From: ShisuiUzumaki
Okay, thanks. I will start working on it and will connect with you if need any guidance.
Comment From: yuuun
This is the first time for joining the issue. I think this will be a good practice for me. Can I have a try?
Comment From: bang128
I am also looking for a good first issue to work on. Is there anything I can help for this issue?
Comment From: topper-123
@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.
Comment From: yuuun
take
Comment From: topper-123
great, I see you've started the PRs. Ping me when you're ready for feedback.
Comment From: jbrockmendel
@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.
Comment From: topper-123
@jbrockmendel , yeah I can take that.
Comment From: topper-123
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.
Comment From: ABCPAN-rank
@topper-123 I'm interested in this issue. Can i try to deprecate is_object ?
Comment From: topper-123
Yes! Ping me when the PR is ready for review.
Comment From: topper-123
@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)?
Comment From: ABCPAN-rank
@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?
Comment From: topper-123
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.
Comment From: ABCPAN-rank
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()
?
Comment From: topper-123
Yes, where it's needed. There may also be places where it's ok to pass complex numbers and booleans.
Comment From: topper-123
Closing as completed.