-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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: remove Index fastpath kwarg #29725
Changes from all commits
01f9cbf
ecdba48
541bd02
2beef6c
c258a77
d6fa489
c0ed56f
cd61136
89e6912
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -259,14 +259,7 @@ def _outer_indexer(self, left, right): | |
# Constructors | ||
|
||
def __new__( | ||
cls, | ||
data=None, | ||
dtype=None, | ||
copy=False, | ||
name=None, | ||
fastpath=None, | ||
tupleize_cols=True, | ||
**kwargs, | ||
cls, data=None, dtype=None, copy=False, name=None, tupleize_cols=True, **kwargs, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure how we historically handle but unfortunate this accepts kwargs - I suppose if someone keeps supplying There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I changed |
||
) -> "Index": | ||
|
||
from .range import RangeIndex | ||
|
@@ -278,16 +271,6 @@ def __new__( | |
if name is None and hasattr(data, "name"): | ||
name = data.name | ||
|
||
if fastpath is not None: | ||
warnings.warn( | ||
"The 'fastpath' keyword is deprecated, and will be " | ||
"removed in a future version.", | ||
FutureWarning, | ||
stacklevel=2, | ||
) | ||
if fastpath: | ||
return cls._simple_new(data, name) | ||
|
||
if isinstance(data, ABCPandasArray): | ||
# ensure users don't accidentally put a PandasArray in an index. | ||
data = data.to_numpy() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
from decimal import Decimal | ||
from itertools import combinations | ||
import operator | ||
from typing import Any, List | ||
|
||
import numpy as np | ||
import pytest | ||
|
@@ -30,6 +31,19 @@ def adjust_negative_zero(zero, expected): | |
return expected | ||
|
||
|
||
# TODO: remove this kludge once mypy stops giving false positives here | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @simonjayhawkins any idea if this is something we can address? |
||
# List comprehension has incompatible type List[PandasObject]; expected List[RangeIndex] | ||
# See GH#????? | ||
ser_or_index: List[Any] = [pd.Series, pd.Index] | ||
lefts: List[Any] = [pd.RangeIndex(10, 40, 10)] | ||
lefts.extend( | ||
[ | ||
cls([10, 20, 30], dtype=dtype) | ||
for dtype in ["i1", "i2", "i4", "i8", "u1", "u2", "u4", "u8", "f2", "f4", "f8"] | ||
for cls in ser_or_index | ||
] | ||
) | ||
|
||
# ------------------------------------------------------------------ | ||
# Comparisons | ||
|
||
|
@@ -81,26 +95,7 @@ class TestNumericArraylikeArithmeticWithDatetimeLike: | |
# TODO: also check name retentention | ||
@pytest.mark.parametrize("box_cls", [np.array, pd.Index, pd.Series]) | ||
@pytest.mark.parametrize( | ||
"left", | ||
[pd.RangeIndex(10, 40, 10)] | ||
+ [ | ||
cls([10, 20, 30], dtype=dtype) | ||
for dtype in [ | ||
"i1", | ||
"i2", | ||
"i4", | ||
"i8", | ||
"u1", | ||
"u2", | ||
"u4", | ||
"u8", | ||
"f2", | ||
"f4", | ||
"f8", | ||
] | ||
for cls in [pd.Series, pd.Index] | ||
], | ||
ids=lambda x: type(x).__name__ + str(x.dtype), | ||
"left", lefts, ids=lambda x: type(x).__name__ + str(x.dtype), | ||
) | ||
def test_mul_td64arr(self, left, box_cls): | ||
# GH#22390 | ||
|
@@ -120,26 +115,7 @@ def test_mul_td64arr(self, left, box_cls): | |
# TODO: also check name retentention | ||
@pytest.mark.parametrize("box_cls", [np.array, pd.Index, pd.Series]) | ||
@pytest.mark.parametrize( | ||
"left", | ||
[pd.RangeIndex(10, 40, 10)] | ||
+ [ | ||
cls([10, 20, 30], dtype=dtype) | ||
for dtype in [ | ||
"i1", | ||
"i2", | ||
"i4", | ||
"i8", | ||
"u1", | ||
"u2", | ||
"u4", | ||
"u8", | ||
"f2", | ||
"f4", | ||
"f8", | ||
] | ||
for cls in [pd.Series, pd.Index] | ||
], | ||
ids=lambda x: type(x).__name__ + str(x.dtype), | ||
"left", lefts, ids=lambda x: type(x).__name__ + str(x.dtype), | ||
) | ||
def test_div_td64arr(self, left, box_cls): | ||
# GH#22390 | ||
|
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.
yes, this was what I had in mind for whatsnew placing.