Skip to content

GHXXX Clean up from stubtest #1267

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 5 commits into from
Jun 30, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions pandas-stubs/core/frame.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1990,15 +1990,13 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
self,
axis: Axis | None = ...,
skipna: _bool | None = ...,
level: None = ...,
numeric_only: _bool = ...,
**kwargs: Any,
) -> Series: ...
def kurtosis(
self,
axis: Axis | None = ...,
skipna: _bool | None = ...,
level: None = ...,
numeric_only: _bool = ...,
**kwargs: Any,
) -> Series: ...
Expand Down Expand Up @@ -2042,15 +2040,13 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
self,
axis: Axis | None = ...,
skipna: _bool | None = ...,
level: None = ...,
numeric_only: _bool = ...,
**kwargs: Any,
) -> Series: ...
def mean(
self,
axis: Axis | None = ...,
skipna: _bool | None = ...,
level: None = ...,
numeric_only: _bool = ...,
**kwargs: Any,
) -> Series: ...
Expand Down
19 changes: 10 additions & 9 deletions pandas-stubs/core/indexes/base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ from pandas._typing import (
DropKeep,
DtypeArg,
DtypeObj,
FillnaOptions,
HashableT,
Label,
Level,
MaskType,
NaPosition,
ReindexMethod,
SliceType,
TimedeltaDtypeArg,
Expand Down Expand Up @@ -313,7 +313,6 @@ class Index(IndexOpsMixin[S1]):
def rename(self, name, inplace: Literal[True]) -> None: ...
@property
def nlevels(self) -> int: ...
def sortlevel(self, level=..., ascending: bool = ..., sort_remaining=...): ...
def get_level_values(self, level: int | _str) -> Index: ...
def droplevel(self, level: Level | list[Level] = ...): ...
@property
Expand Down Expand Up @@ -353,12 +352,7 @@ class Index(IndexOpsMixin[S1]):
def symmetric_difference(
self, other: list[S1] | Self, result_name: Hashable = ..., sort=...
) -> Self: ...
def get_loc(
self,
key: Label,
method: FillnaOptions | Literal["nearest"] | None = ...,
tolerance=...,
) -> int | slice | np_ndarray_bool: ...
def get_loc(self, key: Label) -> int | slice | np_ndarray_bool: ...
def get_indexer(
self, target, method: ReindexMethod | None = ..., limit=..., tolerance=...
): ...
Expand Down Expand Up @@ -400,7 +394,14 @@ class Index(IndexOpsMixin[S1]):
def identical(self, other) -> bool: ...
def asof(self, label): ...
def asof_locs(self, where, mask): ...
def sort_values(self, return_indexer: bool = ..., ascending: bool = ...): ...
def sort_values(
self,
*,
return_indexer: bool = ...,
ascending: bool = ...,
na_position: NaPosition = ...,
key: Callable[[Index], Index] | None = None,
): ...
def sort(self, *args, **kwargs) -> None: ...
def argsort(self, *args, **kwargs): ...
def get_indexer_non_unique(self, target): ...
Expand Down
4 changes: 3 additions & 1 deletion pandas-stubs/core/indexes/category.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ class CategoricalIndex(ExtensionIndex[S1], accessor.PandasDelegate):
@property
def values(self): ...
def __contains__(self, key) -> bool: ...
def __array__(self, dtype=...) -> np.ndarray: ...
def __array__(
self, dtype: DtypeArg = ..., copy: bool | None = ...
) -> np.ndarray: ...
def astype(self, dtype: DtypeArg, copy: bool = ...) -> Index: ...
def fillna(self, value=...): ...
@property
Expand Down
12 changes: 8 additions & 4 deletions pandas-stubs/core/indexes/multi.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ from collections.abc import (
Iterable,
Sequence,
)
from typing import (
overload,
)
from typing import overload

import numpy as np
import pandas as pd
Expand All @@ -20,7 +18,9 @@ from pandas._typing import (
Dtype,
DtypeArg,
HashableT,
Level,
MaskType,
NaPosition,
SequenceNotStr,
np_ndarray_anyint,
np_ndarray_bool,
Expand Down Expand Up @@ -140,7 +140,11 @@ class MultiIndex(Index):
def swaplevel(self, i: int = ..., j: int = ...): ...
def reorder_levels(self, order): ...
def sortlevel(
self, level: int = ..., ascending: bool = ..., sort_remaining: bool = ...
self,
level: Level | Sequence[Level] = ...,
ascending: bool = ...,
sort_remaining: bool = ...,
na_position: NaPosition = ...,
): ...
def get_indexer(self, target, method=..., limit=..., tolerance=...): ...
def get_indexer_non_unique(self, target): ...
Expand Down
2 changes: 0 additions & 2 deletions pandas-stubs/core/interchange/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
from pandas.core.interchange.dataframe_protocol import DataFrame as DataFrame
from pandas.core.interchange.from_dataframe import from_dataframe as from_dataframe
15 changes: 7 additions & 8 deletions pandas-stubs/core/resample.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,9 @@ from typing import (
import numpy as np
from pandas import (
DataFrame,
DatetimeIndex,
Index,
PeriodIndex,
Series,
Timedelta,
TimedeltaIndex,
)
from pandas.core.groupby.generic import SeriesGroupBy
from pandas.core.groupby.groupby import BaseGroupBy
Expand Down Expand Up @@ -62,9 +59,7 @@ _SeriesGroupByFuncArgs: TypeAlias = (
)

class Resampler(BaseGroupBy[NDFrameT]):
grouper: BinGrouper # pyright: ignore[reportIncompatibleVariableOverride] # pyrefly: ignore # variance incompatibility
binner: DatetimeIndex | TimedeltaIndex | PeriodIndex
exclusions: frozenset[Hashable]
_grouper: BinGrouper
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should delete this - not documented

ax: Index
def __getattr__(self, attr: str) -> SeriesGroupBy: ...
@overload
Expand Down Expand Up @@ -123,8 +118,12 @@ class Resampler(BaseGroupBy[NDFrameT]):
def prod(self, numeric_only: bool = ..., min_count: int = ...) -> NDFrameT: ...
def min(self, numeric_only: bool = ..., min_count: int = ...) -> NDFrameT: ...
def max(self, numeric_only: bool = ..., min_count: int = ...) -> NDFrameT: ...
def first(self, numeric_only: bool = ..., min_count: int = ...) -> NDFrameT: ...
def last(self, numeric_only: bool = ..., min_count: int = ...) -> NDFrameT: ...
def first(
self, numeric_only: bool = ..., min_count: int = ..., skipna: bool = ...
) -> NDFrameT: ...
def last(
self, numeric_only: bool = ..., min_count: int = ..., skipna: bool = ...
) -> NDFrameT: ...
def median(self, numeric_only: bool = ...) -> NDFrameT: ...
def mean(self, numeric_only: bool = ...) -> NDFrameT: ...
def std(self, ddof: int = ..., numeric_only: bool = ...) -> NDFrameT: ...
Expand Down
2 changes: 2 additions & 0 deletions tests/test_resampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ def test_agg_funcs() -> None:
check(assert_type(DF.resample("ME").min(), DataFrame), DataFrame)
check(assert_type(DF.resample("ME").max(), DataFrame), DataFrame)
check(assert_type(DF.resample("ME").first(), DataFrame), DataFrame)
check(assert_type(DF.resample("ME").first(skipna=False), DataFrame), DataFrame)
check(assert_type(DF.resample("ME").last(), DataFrame), DataFrame)
check(assert_type(DF.resample("ME").last(skipna=False), DataFrame), DataFrame)
check(assert_type(DF.resample("ME").mean(), DataFrame), DataFrame)
check(assert_type(DF.resample("ME").sum(), DataFrame), DataFrame)
check(assert_type(DF.resample("ME").median(), DataFrame), DataFrame)
Expand Down