Skip to content

DEPR: allowing subclass-specific keywords in pd.Index.__new__ #38597

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

Merged
merged 10 commits into from
Dec 22, 2020
Prev Previous commit
Next Next commit
if -> elif
  • Loading branch information
jbrockmendel committed Dec 22, 2020
commit 3a691bb8f41152ba1fee36992f815275e8ddb411
4 changes: 2 additions & 2 deletions pandas/core/resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -1946,9 +1946,9 @@ def _asfreq_compat(index, freq):
new_index: Index
if isinstance(index, PeriodIndex):
new_index = index.asfreq(freq=freq)
if isinstance(index, DatetimeIndex):
elif isinstance(index, DatetimeIndex):
new_index = DatetimeIndex([], dtype=index.dtype, freq=freq, name=index.name)
if isinstance(index, TimedeltaIndex):
elif isinstance(index, TimedeltaIndex):
new_index = TimedeltaIndex([], dtype=index.dtype, freq=freq, name=index.name)
else: # pragma: no cover
raise TypeError(type(index))
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/indexing/test_coercion.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ def test_insert_index_period(self, insert, coerced_val, coerced_dtype):
msg = r"Unexpected keyword arguments {'freq'}"
with pytest.raises(TypeError, match=msg):
with tm.assert_produces_warning(FutureWarning):
# passing keywords ot pd.Index
# passing keywords to pd.Index
pd.Index(data, freq="M")

def test_insert_index_complex128(self):
Expand Down