Skip to content

Commit 62e794a

Browse files
authored
Undo nightly fix (#521)
* undo patch for nightly not being built * replace IntegerIndex with NumericIndex * fix to_latex test for nightly
1 parent caf9134 commit 62e794a

File tree

4 files changed

+72
-66
lines changed

4 files changed

+72
-66
lines changed

pandas-stubs/core/indexes/accessors.pyi

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ from pandas.core.base import (
2525
PandasObject,
2626
)
2727
from pandas.core.frame import DataFrame
28-
from pandas.core.indexes.numeric import IntegerIndex
28+
from pandas.core.indexes.numeric import NumericIndex
2929
from pandas.core.series import (
3030
PeriodSeries,
3131
Series,
@@ -43,14 +43,14 @@ from pandas._typing import (
4343
class Properties(PandasDelegate, PandasObject, NoNewAttributesMixin):
4444
def __init__(self, data: Series, orig) -> None: ...
4545

46-
_DTFieldOpsReturnType = TypeVar("_DTFieldOpsReturnType", Series[int], IntegerIndex)
46+
_DTFieldOpsReturnType = TypeVar("_DTFieldOpsReturnType", Series[int], NumericIndex)
4747

4848
class _DatetimeFieldOps(
4949
_DayLikeFieldOps[_DTFieldOpsReturnType], _MiniSeconds[_DTFieldOpsReturnType]
5050
): ...
5151
class PeriodIndexFieldOps(
52-
_DayLikeFieldOps[IntegerIndex],
53-
_PeriodProperties[DatetimeIndex, IntegerIndex, Index, DatetimeIndex, PeriodIndex],
52+
_DayLikeFieldOps[NumericIndex],
53+
_PeriodProperties[DatetimeIndex, NumericIndex, Index, DatetimeIndex, PeriodIndex],
5454
): ...
5555

5656
class _DayLikeFieldOps(Generic[_DTFieldOpsReturnType]):
@@ -306,7 +306,7 @@ class TimedeltaProperties(
306306
): ...
307307

308308
_PeriodDTReturnTypes = TypeVar("_PeriodDTReturnTypes", TimestampSeries, DatetimeIndex)
309-
_PeriodIntReturnTypes = TypeVar("_PeriodIntReturnTypes", Series[int], IntegerIndex)
309+
_PeriodIntReturnTypes = TypeVar("_PeriodIntReturnTypes", Series[int], NumericIndex)
310310
_PeriodStrReturnTypes = TypeVar("_PeriodStrReturnTypes", Series[str], Index)
311311
_PeriodDTAReturnTypes = TypeVar("_PeriodDTAReturnTypes", DatetimeArray, DatetimeIndex)
312312
_PeriodPAReturnTypes = TypeVar("_PeriodPAReturnTypes", PeriodArray, PeriodIndex)
@@ -382,7 +382,7 @@ class TimestampProperties(
382382
class DatetimeIndexProperties(
383383
Properties,
384384
_DatetimeNoTZProperties[
385-
IntegerIndex,
385+
NumericIndex,
386386
np_ndarray_bool,
387387
DatetimeIndex,
388388
np.ndarray,

tests/test_frame.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,17 +1310,25 @@ def test_types_to_parquet() -> None:
13101310

13111311
def test_types_to_latex() -> None:
13121312
df = pd.DataFrame([[1, 2], [8, 9]], columns=["A", "B"])
1313-
with pytest.warns(FutureWarning, match="In future versions `DataFrame.to_latex`"):
1313+
with pytest_warns_bounded(
1314+
FutureWarning, match="In future versions `DataFrame.to_latex`", upper="1.5.999"
1315+
):
13141316
df.to_latex(
13151317
columns=["A"], label="some_label", caption="some_caption", multirow=True
13161318
)
1317-
with pytest.warns(FutureWarning, match="In future versions `DataFrame.to_latex`"):
1319+
with pytest_warns_bounded(
1320+
FutureWarning, match="In future versions `DataFrame.to_latex`", upper="1.5.999"
1321+
):
13181322
df.to_latex(escape=False, decimal=",", column_format="r")
13191323
# position param was added in 1.2.0 https://pandas.pydata.org/docs/whatsnew/v1.2.0.html
1320-
with pytest.warns(FutureWarning, match="In future versions `DataFrame.to_latex`"):
1324+
with pytest_warns_bounded(
1325+
FutureWarning, match="In future versions `DataFrame.to_latex`", upper="1.5.999"
1326+
):
13211327
df.to_latex(position="some")
13221328
# caption param was extended to accept tuple in 1.2.0 https://pandas.pydata.org/docs/whatsnew/v1.2.0.html
1323-
with pytest.warns(FutureWarning, match="In future versions `DataFrame.to_latex`"):
1329+
with pytest_warns_bounded(
1330+
FutureWarning, match="In future versions `DataFrame.to_latex`", upper="1.5.999"
1331+
):
13241332
df.to_latex(caption=("cap1", "cap2"))
13251333

13261334

tests/test_pandas.py

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1705,34 +1705,32 @@ def test_pivot_table() -> None:
17051705
),
17061706
pd.DataFrame,
17071707
)
1708-
if PD_LTE_15:
1709-
# Nightly builds failing since 1/12/2023, but this is fixed since then
1710-
check(
1711-
assert_type(
1712-
pd.pivot_table(
1713-
df,
1714-
values="D",
1715-
index=["A", "B"],
1716-
columns=[(7, "seven")],
1717-
aggfunc=np.sum,
1718-
),
1719-
pd.DataFrame,
1708+
check(
1709+
assert_type(
1710+
pd.pivot_table(
1711+
df,
1712+
values="D",
1713+
index=["A", "B"],
1714+
columns=[(7, "seven")],
1715+
aggfunc=np.sum,
17201716
),
17211717
pd.DataFrame,
1722-
)
1723-
check(
1724-
assert_type(
1725-
pd.pivot_table(
1726-
df,
1727-
values="D",
1728-
index=[("col5",), ("col6", 6)],
1729-
columns=[(7, "seven")],
1730-
aggfunc=np.sum,
1731-
),
1732-
pd.DataFrame,
1718+
),
1719+
pd.DataFrame,
1720+
)
1721+
check(
1722+
assert_type(
1723+
pd.pivot_table(
1724+
df,
1725+
values="D",
1726+
index=[("col5",), ("col6", 6)],
1727+
columns=[(7, "seven")],
1728+
aggfunc=np.sum,
17331729
),
17341730
pd.DataFrame,
1735-
)
1731+
),
1732+
pd.DataFrame,
1733+
)
17361734
check(
17371735
assert_type(
17381736
pd.pivot_table(

tests/test_timefuncs.py

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import numpy as np
1313
from numpy import typing as npt
1414
import pandas as pd
15-
from pandas.core.indexes.numeric import IntegerIndex
15+
from pandas.core.indexes.numeric import NumericIndex
1616
import pytz
1717
from typing_extensions import assert_type
1818

@@ -441,37 +441,37 @@ def test_series_dt_accessors() -> None:
441441
def test_datetimeindex_accessors() -> None:
442442
# GH 194
443443
x = pd.DatetimeIndex(["2022-08-14", "2022-08-20"])
444-
check(assert_type(x.month, IntegerIndex), IntegerIndex)
444+
check(assert_type(x.month, NumericIndex), NumericIndex)
445445

446446
i0 = pd.date_range(start="2022-06-01", periods=10)
447447
check(assert_type(i0, pd.DatetimeIndex), pd.DatetimeIndex, pd.Timestamp)
448448

449449
check(assert_type(i0.date, np.ndarray), np.ndarray, dt.date)
450450
check(assert_type(i0.time, np.ndarray), np.ndarray, dt.time)
451451
check(assert_type(i0.timetz, np.ndarray), np.ndarray, dt.time)
452-
check(assert_type(i0.year, IntegerIndex), IntegerIndex, int)
453-
check(assert_type(i0.month, IntegerIndex), IntegerIndex, int)
454-
check(assert_type(i0.day, IntegerIndex), IntegerIndex, int)
455-
check(assert_type(i0.hour, IntegerIndex), IntegerIndex, int)
456-
check(assert_type(i0.minute, IntegerIndex), IntegerIndex, int)
457-
check(assert_type(i0.second, IntegerIndex), IntegerIndex, int)
458-
check(assert_type(i0.microsecond, IntegerIndex), IntegerIndex, int)
459-
check(assert_type(i0.nanosecond, IntegerIndex), IntegerIndex, int)
460-
check(assert_type(i0.dayofweek, IntegerIndex), IntegerIndex, int)
461-
check(assert_type(i0.day_of_week, IntegerIndex), IntegerIndex, int)
462-
check(assert_type(i0.weekday, IntegerIndex), IntegerIndex, int)
463-
check(assert_type(i0.dayofyear, IntegerIndex), IntegerIndex, int)
464-
check(assert_type(i0.day_of_year, IntegerIndex), IntegerIndex, int)
465-
check(assert_type(i0.quarter, IntegerIndex), IntegerIndex, int)
452+
check(assert_type(i0.year, NumericIndex), NumericIndex, int)
453+
check(assert_type(i0.month, NumericIndex), NumericIndex, int)
454+
check(assert_type(i0.day, NumericIndex), NumericIndex, int)
455+
check(assert_type(i0.hour, NumericIndex), NumericIndex, int)
456+
check(assert_type(i0.minute, NumericIndex), NumericIndex, int)
457+
check(assert_type(i0.second, NumericIndex), NumericIndex, int)
458+
check(assert_type(i0.microsecond, NumericIndex), NumericIndex, int)
459+
check(assert_type(i0.nanosecond, NumericIndex), NumericIndex, int)
460+
check(assert_type(i0.dayofweek, NumericIndex), NumericIndex, int)
461+
check(assert_type(i0.day_of_week, NumericIndex), NumericIndex, int)
462+
check(assert_type(i0.weekday, NumericIndex), NumericIndex, int)
463+
check(assert_type(i0.dayofyear, NumericIndex), NumericIndex, int)
464+
check(assert_type(i0.day_of_year, NumericIndex), NumericIndex, int)
465+
check(assert_type(i0.quarter, NumericIndex), NumericIndex, int)
466466
check(assert_type(i0.is_month_start, npt.NDArray[np.bool_]), np.ndarray, np.bool_)
467467
check(assert_type(i0.is_month_end, npt.NDArray[np.bool_]), np.ndarray, np.bool_)
468468
check(assert_type(i0.is_quarter_start, npt.NDArray[np.bool_]), np.ndarray, np.bool_)
469469
check(assert_type(i0.is_quarter_end, npt.NDArray[np.bool_]), np.ndarray, np.bool_)
470470
check(assert_type(i0.is_year_start, npt.NDArray[np.bool_]), np.ndarray, np.bool_)
471471
check(assert_type(i0.is_year_end, npt.NDArray[np.bool_]), np.ndarray, np.bool_)
472472
check(assert_type(i0.is_leap_year, npt.NDArray[np.bool_]), np.ndarray, np.bool_)
473-
check(assert_type(i0.daysinmonth, IntegerIndex), IntegerIndex, int)
474-
check(assert_type(i0.days_in_month, IntegerIndex), IntegerIndex, int)
473+
check(assert_type(i0.daysinmonth, NumericIndex), NumericIndex, int)
474+
check(assert_type(i0.days_in_month, NumericIndex), NumericIndex, int)
475475
check(assert_type(i0.tz, Optional[dt.tzinfo]), type(None))
476476
check(assert_type(i0.freq, Optional[BaseOffset]), BaseOffset)
477477
check(assert_type(i0.isocalendar(), pd.DataFrame), pd.DataFrame)
@@ -531,20 +531,20 @@ def test_periodindex_accessors() -> None:
531531
i0 = pd.period_range(start="2022-06-01", periods=10)
532532
check(assert_type(i0, pd.PeriodIndex), pd.PeriodIndex, pd.Period)
533533

534-
check(assert_type(i0.year, IntegerIndex), IntegerIndex, int)
535-
check(assert_type(i0.month, IntegerIndex), IntegerIndex, int)
536-
check(assert_type(i0.day, IntegerIndex), IntegerIndex, int)
537-
check(assert_type(i0.hour, IntegerIndex), IntegerIndex, int)
538-
check(assert_type(i0.minute, IntegerIndex), IntegerIndex, int)
539-
check(assert_type(i0.second, IntegerIndex), IntegerIndex, int)
540-
check(assert_type(i0.dayofweek, IntegerIndex), IntegerIndex, int)
541-
check(assert_type(i0.day_of_week, IntegerIndex), IntegerIndex, int)
542-
check(assert_type(i0.weekday, IntegerIndex), IntegerIndex, int)
543-
check(assert_type(i0.dayofyear, IntegerIndex), IntegerIndex, int)
544-
check(assert_type(i0.day_of_year, IntegerIndex), IntegerIndex, int)
545-
check(assert_type(i0.quarter, IntegerIndex), IntegerIndex, int)
546-
check(assert_type(i0.daysinmonth, IntegerIndex), IntegerIndex, int)
547-
check(assert_type(i0.days_in_month, IntegerIndex), IntegerIndex, int)
534+
check(assert_type(i0.year, NumericIndex), NumericIndex, int)
535+
check(assert_type(i0.month, NumericIndex), NumericIndex, int)
536+
check(assert_type(i0.day, NumericIndex), NumericIndex, int)
537+
check(assert_type(i0.hour, NumericIndex), NumericIndex, int)
538+
check(assert_type(i0.minute, NumericIndex), NumericIndex, int)
539+
check(assert_type(i0.second, NumericIndex), NumericIndex, int)
540+
check(assert_type(i0.dayofweek, NumericIndex), NumericIndex, int)
541+
check(assert_type(i0.day_of_week, NumericIndex), NumericIndex, int)
542+
check(assert_type(i0.weekday, NumericIndex), NumericIndex, int)
543+
check(assert_type(i0.dayofyear, NumericIndex), NumericIndex, int)
544+
check(assert_type(i0.day_of_year, NumericIndex), NumericIndex, int)
545+
check(assert_type(i0.quarter, NumericIndex), NumericIndex, int)
546+
check(assert_type(i0.daysinmonth, NumericIndex), NumericIndex, int)
547+
check(assert_type(i0.days_in_month, NumericIndex), NumericIndex, int)
548548
check(assert_type(i0.freq, Optional[BaseOffset]), BaseOffset)
549549
check(assert_type(i0.strftime("%Y"), pd.Index), pd.Index, str)
550550
check(assert_type(i0.asfreq("D"), pd.PeriodIndex), pd.PeriodIndex, pd.Period)

0 commit comments

Comments
 (0)