You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Sometimes the result of difference, intersection, union could still be represented as a `RangeIndex
In [3]: fromcudfimport*In [4]: idx=Index(range(4))[::-1]
...: other=Index(range(3, 4))
...:
...: result=idx.difference(other)
In [5]: idxOut[5]: RangeIndex(start=3, stop=-1, step=-1)
In [6]: otherOut[6]: RangeIndex(start=3, stop=4, step=1)
In [7]: resultOut[7]: Int64Index([0, 1, 2], dtype='int64')
Describe the solution you'd like
In the case above, RangeIndex(0, 3, 1) could have been returned
Describe alternatives you've considered
Casting directly to a RangeIndex
Additional context
Add any other context, code examples, or references to existing implementations about the feature request here.
The text was updated successfully, but these errors were encountered:
This PR fixes `Index.difference` in following ways:
- [x] Fixes `name` preservation by correctly evaluating the name of two input objects, closes#14019
- [x] Fixes `is_mixed_with_object_dtype` handling that will resolve incorrect results for `CategoricalIndex`, closes#14022
- [x] Raises errors for invalid input types, the error messages are an exact match to pandas error messages for parity.
- [x] Introduce a `Range._try_reconstruct_range_index` that will try to re-construct a `RangeIndex` out of an `Int..Index` to save memory- this is on parity with pandas. closes#14013
Authors:
- GALI PREM SAGAR (https://github.com/galipremsagar)
Approvers:
- Lawrence Mitchell (https://github.com/wence-)
URL: #14053
Is your feature request related to a problem? Please describe.
Sometimes the result of
difference
,intersection
,union
could still be represented as a `RangeIndexDescribe the solution you'd like
In the case above,
RangeIndex(0, 3, 1)
could have been returnedDescribe alternatives you've considered
Casting directly to a RangeIndex
Additional context
Add any other context, code examples, or references to existing implementations about the feature request here.
The text was updated successfully, but these errors were encountered: