Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 3 additions & 3 deletions pandas-stubs/_libs/tslibs/offsets.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,15 @@ class _CustomBusinessMonth(SingleConstructorOffset):
n: int = ...,
normalize: bool = ...,
offset: timedelta = ...,
holidays: list | None = ...,
holidays: list[Any] | None = ...,
) -> None: ...

class CustomBusinessDay(BusinessDay):
def __init__(
self,
n: int = ...,
normalize: bool = ...,
holidays: list = ...,
holidays: list[Any] = ...,
calendar: AbstractHolidayCalendar | np.busdaycalendar = ...,
) -> None: ...

Expand All @@ -225,7 +225,7 @@ class CustomBusinessHour(BusinessHour):
start: str | time | Collection[str | time] = ...,
end: str | time | Collection[str | time] = ...,
offset: timedelta = ...,
holidays: list | None = ...,
holidays: list[Any] | None = ...,
) -> None: ...

class CustomBusinessMonthEnd(_CustomBusinessMonth): ...
Expand Down
4 changes: 2 additions & 2 deletions pandas-stubs/_typing.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ Level: TypeAlias = Hashable
Shape: TypeAlias = tuple[int, ...]
Suffixes: TypeAlias = tuple[str | None, str | None] | list[str | None]
Ordered: TypeAlias = bool | None
JSONSerializable: TypeAlias = PythonScalar | list | dict
JSONSerializable: TypeAlias = PythonScalar | list[Any] | dict
Frequency: TypeAlias = str | BaseOffset
PeriodFrequency: TypeAlias = (
str
Expand Down Expand Up @@ -966,7 +966,7 @@ ListLikeT = TypeVar("ListLikeT", bound=ListLike)
ListLikeExceptSeriesAndStr: TypeAlias = (
MutableSequence[Any] | np_1darray | tuple[Any, ...] | Index
)
ListLikeU: TypeAlias = Sequence | np_1darray | Series | Index
ListLikeU: TypeAlias = Sequence[Any] | np_1darray | Series | Index
ListLikeHashable: TypeAlias = (
MutableSequence[HashableT] | np_1darray | tuple[HashableT, ...] | range
)
Expand Down
8 changes: 4 additions & 4 deletions pandas-stubs/core/frame.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -552,15 +552,15 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
*,
into: MutableMapping | type[MutableMapping],
index: bool = ...,
) -> MutableMapping[str, list]: ...
) -> MutableMapping[str, list[Any]]: ...
@overload
def to_dict(
self,
orient: Literal["split", "tight"],
*,
into: type[dict] = ...,
index: bool = ...,
) -> dict[str, list]: ...
) -> dict[str, list[Any]]: ...
@classmethod
def from_records(
cls,
Expand Down Expand Up @@ -1256,7 +1256,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
keep: NsmallestNlargestKeep = "first",
) -> Self: ...
def swaplevel(self, i: Level = ..., j: Level = ..., axis: Axis = 0) -> Self: ...
def reorder_levels(self, order: list, axis: Axis = 0) -> Self: ...
def reorder_levels(self, order: list[int] | list[str], axis: Axis = 0) -> Self: ...
def compare(
self,
other: DataFrame,
Expand Down Expand Up @@ -1796,7 +1796,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
def hist(
self,
by: _str | ListLike | None = None,
bins: int | list = 10,
bins: int | Sequence[int] = 10,
*,
grid: _bool = True,
xlabelsize: float | str | None = None,
Expand Down
6 changes: 4 additions & 2 deletions pandas-stubs/core/groupby/generic.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -219,15 +219,17 @@ _TT = TypeVar("_TT", bound=Literal[True, False])
class DFCallable1(Protocol[P]): # ty: ignore[invalid-argument-type]
def __call__(
self, df: DataFrame, /, *args: P.args, **kwargs: P.kwargs
) -> Scalar | list | dict: ...
) -> Scalar | list[Any] | dict: ...

class DFCallable2(Protocol[P]): # ty: ignore[invalid-argument-type]
def __call__(
self, df: DataFrame, /, *args: P.args, **kwargs: P.kwargs
) -> DataFrame | Series: ...

class DFCallable3(Protocol[P]): # ty: ignore[invalid-argument-type]
def __call__(self, df: Iterable, /, *args: P.args, **kwargs: P.kwargs) -> float: ...
def __call__(
self, df: Iterable[Any], /, *args: P.args, **kwargs: P.kwargs
) -> float: ...

class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT, _TT]):
# error: Overload 3 for "apply" will never be used because its parameters overlap overload 1
Expand Down
2 changes: 1 addition & 1 deletion pandas-stubs/core/groupby/groupby.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ class GroupBy(BaseGroupBy[NDFrameT]):
n: int | None = None,
frac: float | None = None,
replace: bool = False,
weights: Sequence | Series | None = ...,
weights: Sequence[float] | Series | None = ...,
random_state: RandomState | None = ...,
) -> NDFrameT: ...

Expand Down
2 changes: 1 addition & 1 deletion pandas-stubs/core/indexes/base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ class Index(IndexOpsMixin[S1], ElementOpsMixin[S1]):
def intersection(
self, other: list[S1] | Self, sort: bool | None = False
) -> Self: ...
def difference(self, other: list | Self, sort: bool | None = None) -> Self: ...
def difference(self, other: list[Any] | Self, sort: bool | None = None) -> Self: ...
def symmetric_difference(
self,
other: list[S1] | Self,
Expand Down
11 changes: 0 additions & 11 deletions pandas-stubs/core/indexes/multi.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from collections.abc import (
Callable,
Collection,
Hashable,
Iterable,
Expand Down Expand Up @@ -91,16 +90,6 @@ class MultiIndex(Index):
def memory_usage(self, deep: bool = False) -> int: ...
@property
def nbytes(self) -> int: ...
def format(
self,
name: bool | None = ...,
formatter: Callable[..., Any] | None = ...,
na_rep: str | None = ...,
names: bool = ...,
space: int = ...,
sparsify: bool | None = ...,
adjoin: bool = ...,
) -> list: ...
Comment on lines -94 to -103
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Undocumented

def __len__(self) -> int: ...
@property
def values(self): ...
Expand Down
12 changes: 7 additions & 5 deletions pandas-stubs/core/reshape/pivot.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ from pandas._typing import (
Label,
Scalar,
ScalarT,
SequenceNotStr,
np_ndarray,
)

Expand Down Expand Up @@ -61,6 +62,7 @@ _PivotTableColumnsTypes: TypeAlias = (
_PivotTableValuesTypes: TypeAlias = Label | Sequence[HashableT3] | None

_ExtendedAnyArrayLike: TypeAlias = AnyArrayLike | ArrayLike
_Values: TypeAlias = SequenceNotStr[Any] | _ExtendedAnyArrayLike

@overload
def pivot_table(
Expand Down Expand Up @@ -123,9 +125,9 @@ def pivot(
) -> DataFrame: ...
@overload
def crosstab(
index: list | _ExtendedAnyArrayLike | list[Sequence | _ExtendedAnyArrayLike],
columns: list | _ExtendedAnyArrayLike | list[Sequence | _ExtendedAnyArrayLike],
values: list | _ExtendedAnyArrayLike,
index: _Values | list[_Values],
columns: _Values | list[_Values],
values: _Values,
rownames: list[HashableT1] | None = ...,
colnames: list[HashableT2] | None = ...,
*,
Expand All @@ -137,8 +139,8 @@ def crosstab(
) -> DataFrame: ...
@overload
def crosstab(
index: list | _ExtendedAnyArrayLike | list[Sequence | _ExtendedAnyArrayLike],
columns: list | _ExtendedAnyArrayLike | list[Sequence | _ExtendedAnyArrayLike],
index: _Values | list[_Values],
columns: _Values | list[_Values],
values: None = None,
rownames: list[HashableT1] | None = ...,
colnames: list[HashableT2] | None = ...,
Expand Down
7 changes: 3 additions & 4 deletions pandas-stubs/core/series.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ from collections.abc import (
Mapping,
MutableMapping,
Sequence,
Set as AbstractSet,
ValuesView,
)
from datetime import (
Expand Down Expand Up @@ -564,8 +565,6 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
def __array__( # ty: ignore[invalid-method-override]
self, dtype: _str | np.dtype = ..., copy: bool | None = ...
) -> np_1darray: ...
@property
def axes(self) -> list: ...
@final
def __getattr__(self, name: _str) -> S1: ...

Expand Down Expand Up @@ -1171,7 +1170,7 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
def apply(
self,
func: Callable[
..., Scalar | Sequence | set | Mapping | NAType | frozenset | None
..., Scalar | Sequence[Any] | AbstractSet[Any] | Mapping | NAType | None
],
convertDType: _bool = ...,
args: tuple[Any, ...] = ...,
Expand Down Expand Up @@ -1373,7 +1372,7 @@ class Series(IndexOpsMixin[S1], ElementOpsMixin[S1], NDFrame):
ylabelsize: float | _str | None = None,
yrot: float | None = None,
figsize: tuple[float, float] | None = None,
bins: int | Sequence = 10,
bins: int | Sequence[int] = 10,
backend: _str | None = None,
legend: _bool = False,
**kwargs: Any,
Expand Down
33 changes: 17 additions & 16 deletions pandas-stubs/io/formats/style.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from collections.abc import (
Callable,
Hashable,
MutableMapping,
Sequence,
)
Expand Down Expand Up @@ -50,7 +51,7 @@ from pandas.io.formats.style_render import (
class _SeriesFunc(Protocol):
def __call__(
self, series: Series, /, *args: Any, **kwargs: Any
) -> list | Series: ...
) -> list[Any] | Series: ...

class _DataFrameFunc(Protocol):
def __call__(
Expand Down Expand Up @@ -84,13 +85,13 @@ class Styler(StylerRenderer):
def map(
self,
func: Callable[[Scalar], str | None],
subset: Subset | None = ...,
subset: Subset[Hashable] | None = ...,
) -> Styler: ...
@overload
def map(
self,
func: _MapCallable,
subset: Subset | None = ...,
subset: Subset[Hashable] | None = ...,
**kwargs: Any,
) -> Styler: ...
def set_tooltips(
Expand Down Expand Up @@ -233,17 +234,17 @@ class Styler(StylerRenderer):
@overload
def apply(
self,
func: _SeriesFunc | Callable[[Series], list | Series],
func: _SeriesFunc | Callable[[Series], list[Any] | Series],
axis: Axis = ...,
subset: Subset | None = ...,
subset: Subset[Hashable] | None = ...,
**kwargs: Any,
) -> Styler: ...
@overload
def apply(
self,
func: _DataFrameFunc | Callable[[DataFrame], np_ndarray | DataFrame],
axis: None,
subset: Subset | None = ...,
subset: Subset[Hashable] | None = ...,
**kwargs: Any,
) -> Styler: ...
def apply_index(
Expand Down Expand Up @@ -280,7 +281,7 @@ class Styler(StylerRenderer):
) -> Styler: ...
def hide(
self,
subset: Subset | None = ...,
subset: Subset[Hashable] | None = ...,
axis: Axis = ...,
level: Level | list[Level] | None = ...,
names: bool = ...,
Expand All @@ -291,7 +292,7 @@ class Styler(StylerRenderer):
low: float = 0,
high: float = 0,
axis: Axis | None = 0,
subset: Subset | None = None,
subset: Subset[Hashable] | None = None,
text_color_threshold: float = 0.408,
vmin: float | None = None,
vmax: float | None = None,
Expand All @@ -310,7 +311,7 @@ class Styler(StylerRenderer):
low: float = 0,
high: float = 0,
axis: Axis | None = 0,
subset: Subset | None = None,
subset: Subset[Hashable] | None = None,
vmin: float | None = None,
vmax: float | None = None,
gmap: (
Expand All @@ -323,11 +324,11 @@ class Styler(StylerRenderer):
) = None,
) -> Styler: ...
def set_properties(
self, subset: Subset | None = ..., **kwargs: str | int
self, subset: Subset[Hashable] | None = ..., **kwargs: str | int
) -> Styler: ...
def bar(
self,
subset: Subset | None = None,
subset: Subset[Hashable] | None = None,
axis: Axis | None = 0,
*,
color: str | list[str] | tuple[str, str] | None = None,
Expand All @@ -346,26 +347,26 @@ class Styler(StylerRenderer):
def highlight_null(
self,
color: str | None = "red",
subset: Subset | None = None,
subset: Subset[Hashable] | None = None,
props: str | None = None,
) -> Styler: ...
def highlight_max(
self,
subset: Subset | None = None,
subset: Subset[Hashable] | None = None,
color: str = "yellow",
axis: Axis | None = 0,
props: str | None = None,
) -> Styler: ...
def highlight_min(
self,
subset: Subset | None = None,
subset: Subset[Hashable] | None = None,
color: str = "yellow",
axis: Axis | None = 0,
props: str | None = None,
) -> Styler: ...
def highlight_between(
self,
subset: Subset | None = None,
subset: Subset[Hashable] | None = None,
color: str = "yellow",
axis: Axis | None = 0,
left: Scalar | list[Scalar] | None = None,
Expand All @@ -375,7 +376,7 @@ class Styler(StylerRenderer):
) -> Styler: ...
def highlight_quantile(
self,
subset: Subset | None = None,
subset: Subset[Hashable] | None = None,
color: str = "yellow",
axis: Axis | None = 0,
q_left: float = 0,
Expand Down
3 changes: 2 additions & 1 deletion pandas-stubs/io/formats/style_render.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from collections.abc import (
Callable,
Hashable,
Sequence,
)
from typing import (
Expand Down Expand Up @@ -57,7 +58,7 @@ class StylerRenderer:
def format(
self,
formatter: ExtFormatter | None = None,
subset: Subset | None = None,
subset: Subset[Hashable] | None = None,
na_rep: str | None = None,
precision: int | None = None,
decimal: str = ".",
Expand Down
2 changes: 1 addition & 1 deletion pandas-stubs/io/json/_normalize.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ from pandas._typing import IgnoreRaise

def json_normalize(
data: dict | list[dict],
record_path: str | list | None = None,
record_path: str | list[str] | None = None,
meta: str | list[str | list[str]] | None = None,
meta_prefix: str | None = None,
record_prefix: str | None = None,
Expand Down
2 changes: 1 addition & 1 deletion pandas-stubs/io/parsers/readers.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ class TextFileReader(abc.Iterator):
squeeze: bool
def __init__(
self,
f: FilePath | ReadCsvBuffer[bytes] | ReadCsvBuffer[str] | list,
f: FilePath | ReadCsvBuffer[bytes] | ReadCsvBuffer[str] | list[str],
engine: CSVEngine | None = ...,
**kwds: Any,
) -> None: ...
Expand Down
4 changes: 2 additions & 2 deletions pandas-stubs/io/pytables.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,10 @@ class HDFStore:
"namereplace",
] = "strict",
) -> None: ...
def groups(self) -> list: ...
def groups(self) -> list[object]: ...
def walk(
self, where: str = "/"
) -> Generator[tuple[str, list, list[str]], None, None]: ...
) -> Generator[tuple[str, list[str], list[str]], None, None]: ...
def info(self) -> str: ...

class TableIterator:
Expand Down
Loading