-
-
Notifications
You must be signed in to change notification settings - Fork 18k
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
DEPR: Index.asi8 #37877
DEPR: Index.asi8 #37877
Conversation
@@ -415,6 +415,11 @@ def asi8(self): | |||
ndarray | |||
An ndarray with int64 dtype. | |||
""" | |||
warnings.warn( | |||
"Index.asi8 is deprecated and will be removed in a future version", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add that the replacement is .astype('i8')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trouble is thats not really correct for the Index classes we're deprecating it for. For these classes .asi8 returns None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh ok. are we deprecating for DTI and cousins? (I think we should do that as well to be consistent).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ill take a look; that might be pretty invasive
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok i think you should make this an internal method and deprecate the user facing one (even though we use it internally in the many parts of pandas)
result = np.array(self) | ||
if needs_i8_conversion(self.dtype): | ||
# TODO: these do not match the underlying EA argsort methods GH#37863 | ||
return self.asi8.argsort(*args, **kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are you calling .asi8 here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment just above #37863 a handful of tests fail if we pass through to the backing EA.argsort
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
won't these show the deprecation warning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, because we're not deprecating it for the datetimelike classes
values = arg.asi8 | ||
if values is None: | ||
if needs_i8_conversion(arg.dtype): | ||
values = arg.asi8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aren't you deprecating this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only deprecating the one in pd.Index that returns None
doc/source/whatsnew/v1.2.0.rst
Outdated
@@ -457,7 +457,8 @@ Deprecations | |||
- :class:`Index` methods ``&``, ``|``, and ``^`` behaving as the set operations :meth:`Index.intersection`, :meth:`Index.union`, and :meth:`Index.symmetric_difference`, respectively, are deprecated and in the future will behave as pointwise boolean operations matching :class:`Series` behavior. Use the named set methods instead (:issue:`36758`) | |||
- :meth:`Categorical.is_dtype_equal` and :meth:`CategoricalIndex.is_dtype_equal` are deprecated, will be removed in a future version (:issue:`37545`) | |||
- :meth:`Series.slice_shift` and :meth:`DataFrame.slice_shift` are deprecated, use :meth:`Series.shift` or :meth:`DataFrame.shift` instead (:issue:`37601`) | |||
- Partial slicing on unordered :class:`DatetimeIndexes` with keys, which are not in Index is deprecated and will be removed in a future version (:issue:`18531`) | |||
- Partial slicing on unordered :class:`DatetimeIndex` with keys, which are not in Index is deprecated and will be removed in a future version (:issue:`18531`) | |||
- Deprecated :meth:`Index.asi8` (:issue:`37877`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you clarify this deprecation is only for the non-datetimelike Index subclasses for which the attribute currently returns None?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea, will update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated + greenish
(whatsnew conflict) |
ok resolved, will merge on greenish |
thanks @jbrockmendel |
### What changes were proposed in this pull request? This PR proposes to remove deprecated `Index` APIs from Pandas API on Spark. ### Why are the changes needed? To follow the behavior of the latest Pandas. See pandas-dev/pandas#37877 for `Index.asi8` See pandas-dev/pandas#42113 for `Index.is_type_compatible` ### Does this PR introduce _any_ user-facing change? `Index.asi8`, `Index.is_type_compatible` is removed. `Index.astype` and `Index.isin` can be used instead respectively. ### How was this patch tested? The existing CI should pass. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #42926 from itholic/SPARK-45164. Authored-by: Haejoon Lee <haejoon.lee@databricks.com> Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff