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
55 changes: 28 additions & 27 deletions pandas-stubs/_testing/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ from pandas.arrays import (
)
from pandas.core.arrays.base import ExtensionArray

from pandas._libs.lib import _NoDefaultDoNotUse
from pandas._typing import (
AnyArrayLike,
T,
Expand Down Expand Up @@ -101,19 +102,19 @@ def assert_extension_array_equal(
def assert_series_equal(
left: Series,
right: Series,
check_dtype: bool | Literal["equiv"] = ...,
check_index_type: bool | Literal["equiv"] = ...,
check_series_type: bool = ...,
check_names: bool = ...,
check_exact: bool = ...,
check_datetimelike_compat: bool = ...,
check_categorical: bool = ...,
check_category_order: bool = ...,
check_freq: bool = ...,
check_flags: bool = ...,
rtol: float = ...,
atol: float = ...,
obj: str = ...,
check_dtype: bool | Literal["equiv"] = True,
check_index_type: bool | Literal["equiv"] = "equiv",
check_series_type: bool = True,
check_names: bool = True,
check_exact: bool | _NoDefaultDoNotUse = ...,
check_datetimelike_compat: bool = False,
check_categorical: bool = True,
check_category_order: bool = True,
check_freq: bool = True,
check_flags: bool = True,
rtol: float | _NoDefaultDoNotUse = ...,
atol: float | _NoDefaultDoNotUse = ...,
obj: str = "Series",
*,
check_index: Literal[False],
check_like: Literal[False] = False,
Expand All @@ -122,22 +123,22 @@ def assert_series_equal(
def assert_series_equal(
left: Series,
right: Series,
check_dtype: bool | Literal["equiv"] = ...,
check_index_type: bool | Literal["equiv"] = ...,
check_series_type: bool = ...,
check_names: bool = ...,
check_exact: bool = ...,
check_datetimelike_compat: bool = ...,
check_categorical: bool = ...,
check_category_order: bool = ...,
check_freq: bool = ...,
check_flags: bool = ...,
rtol: float = ...,
atol: float = ...,
obj: str = ...,
check_dtype: bool | Literal["equiv"] = True,
check_index_type: bool | Literal["equiv"] = "equiv",
check_series_type: bool = True,
check_names: bool = True,
check_exact: bool | _NoDefaultDoNotUse = ...,
check_datetimelike_compat: bool = False,
check_categorical: bool = True,
check_category_order: bool = True,
check_freq: bool = True,
check_flags: bool = True,
rtol: float | _NoDefaultDoNotUse = ...,
atol: float | _NoDefaultDoNotUse = ...,
obj: str = "Series",
*,
check_index: Literal[True] = True,
check_like: bool = ...,
check_like: bool = False,
) -> None: ...
def assert_frame_equal(
left: DataFrame,
Expand Down
18 changes: 9 additions & 9 deletions pandas-stubs/core/algorithms.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -69,23 +69,23 @@ def unique(values: T_EXTENSION_ARRAY) -> T_EXTENSION_ARRAY: ...
@overload
def factorize(
values: npt.NDArray[GenericT],
sort: bool = ...,
use_na_sentinel: bool = ...,
size_hint: int | None = ...,
sort: bool = False,
use_na_sentinel: bool = True,
size_hint: int | None = None,
) -> tuple[np_1darray_int64, np_1darray[GenericT]]: ...
@overload
def factorize(
values: Index | Series,
sort: bool = ...,
use_na_sentinel: bool = ...,
size_hint: int | None = ...,
sort: bool = False,
use_na_sentinel: bool = True,
size_hint: int | None = None,
) -> tuple[np_1darray_int64, Index]: ...
@overload
def factorize(
values: Categorical,
sort: bool = ...,
use_na_sentinel: bool = ...,
size_hint: int | None = ...,
sort: bool = False,
use_na_sentinel: bool = True,
size_hint: int | None = None,
) -> tuple[np_1darray_int64, Categorical]: ...
def take(
arr: np_ndarray[Any] | ExtensionArray | Index | Series,
Expand Down
2 changes: 1 addition & 1 deletion pandas-stubs/core/computation/eval.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ from pandas._typing import (
def eval(
expr: str | BinOp,
parser: Literal["pandas", "python"] = "pandas",
engine: Literal["python", "numexpr"] | None = ...,
engine: Literal["python", "numexpr"] | None = None,
local_dict: dict[str, Any] | None = None,
global_dict: dict[str, Any] | None = None,
resolvers: MutableSequence[Mapping[Any, Any]] | None = ...,
Expand Down
60 changes: 30 additions & 30 deletions pandas-stubs/core/groupby/generic.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -324,48 +324,48 @@ class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT, _TT]):
def boxplot(
self,
subplots: Literal[True] = True,
column: IndexLabel | None = ...,
fontsize: float | str | None = ...,
rot: float = ...,
grid: bool = ...,
ax: PlotAxes | None = ...,
figsize: tuple[float, float] | None = ...,
layout: tuple[int, int] | None = ...,
sharex: bool = ...,
sharey: bool = ...,
backend: str | None = ...,
column: IndexLabel | None = None,
fontsize: float | str | None = None,
rot: float = 0,
grid: bool = True,
ax: PlotAxes | None = None,
figsize: tuple[float, float] | None = None,
layout: tuple[int, int] | None = None,
sharex: bool = False,
sharey: bool = True,
backend: str | None = None,
**kwargs: Any,
) -> Series: ... # Series[PlotAxes] but this is not allowed
@overload
def boxplot(
self,
subplots: Literal[False],
column: IndexLabel | None = ...,
fontsize: float | str | None = ...,
rot: float = ...,
grid: bool = ...,
ax: PlotAxes | None = ...,
figsize: tuple[float, float] | None = ...,
layout: tuple[int, int] | None = ...,
sharex: bool = ...,
sharey: bool = ...,
backend: str | None = ...,
column: IndexLabel | None = None,
fontsize: float | str | None = None,
rot: float = 0,
grid: bool = True,
ax: PlotAxes | None = None,
figsize: tuple[float, float] | None = None,
layout: tuple[int, int] | None = None,
sharex: bool = False,
sharey: bool = True,
backend: str | None = None,
**kwargs: Any,
) -> PlotAxes: ...
@overload
def boxplot(
self,
subplots: bool,
column: IndexLabel | None = ...,
fontsize: float | str | None = ...,
rot: float = ...,
grid: bool = ...,
ax: PlotAxes | None = ...,
figsize: tuple[float, float] | None = ...,
layout: tuple[int, int] | None = ...,
sharex: bool = ...,
sharey: bool = ...,
backend: str | None = ...,
column: IndexLabel | None = None,
fontsize: float | str | None = None,
rot: float = 0,
grid: bool = True,
ax: PlotAxes | None = None,
figsize: tuple[float, float] | None = None,
layout: tuple[int, int] | None = None,
sharex: bool = False,
sharey: bool = True,
backend: str | None = None,
**kwargs: Any,
) -> PlotAxes | Series: ... # Series[PlotAxes]
@overload
Expand Down
58 changes: 30 additions & 28 deletions pandas-stubs/core/indexes/datetimes.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ from datetime import (
import sys
from typing import (
Any,
Literal,
final,
overload,
)

import numpy as np
import pandas as pd
from pandas.core.frame import DataFrame
from pandas.core.indexes.accessors import DatetimeIndexProperties
from pandas.core.indexes.base import Index
Expand All @@ -31,13 +33,13 @@ from pandas._libs.tslibs.timestamps import Timestamp
from pandas._typing import (
AxesData,
DateAndDatetimeLike,
Dtype,
Frequency,
IntervalClosedType,
TimeUnit,
TimeZones,
np_1darray_intp,
np_ndarray,
np_ndarray_bool,
np_ndarray_dt,
np_ndarray_td,
)
Expand All @@ -54,12 +56,12 @@ class DatetimeIndex(
data: AxesData,
freq: Frequency = ...,
tz: TimeZones = ...,
ambiguous: str = ...,
dayfirst: bool = ...,
yearfirst: bool = ...,
dtype: Dtype = ...,
copy: bool = ...,
name: Hashable = ...,
ambiguous: Literal["infer", "NaT", "raise"] | np_ndarray_bool = "raise",
dayfirst: bool = False,
yearfirst: bool = False,
dtype: np.dtype[np.datetime64] | pd.DatetimeTZDtype | str | None = None,
copy: bool = False,
name: Hashable = None,
) -> Self: ...

# various ignores needed for mypy, as we do want to restrict what can be used in
Expand Down Expand Up @@ -123,7 +125,7 @@ def date_range(
freq: Frequency | timedelta | None = None,
tz: TimeZones = None,
normalize: bool = False,
name: Hashable | None = None,
name: Hashable = None,
inclusive: IntervalClosedType = "both",
unit: TimeUnit | None = None,
) -> DatetimeIndex: ...
Expand All @@ -134,7 +136,7 @@ def date_range(
periods: int,
tz: TimeZones = None,
normalize: bool = False,
name: Hashable | None = None,
name: Hashable = None,
inclusive: IntervalClosedType = "both",
unit: TimeUnit | None = None,
) -> DatetimeIndex: ...
Expand All @@ -146,7 +148,7 @@ def date_range(
freq: Frequency | timedelta | None = None,
tz: TimeZones = None,
normalize: bool = False,
name: Hashable | None = None,
name: Hashable = None,
inclusive: IntervalClosedType = "both",
unit: TimeUnit | None = None,
) -> DatetimeIndex: ...
Expand All @@ -158,34 +160,34 @@ def date_range(
freq: Frequency | timedelta | None = None,
tz: TimeZones = None,
normalize: bool = False,
name: Hashable | None = None,
name: Hashable = None,
inclusive: IntervalClosedType = "both",
unit: TimeUnit | None = None,
) -> DatetimeIndex: ...
@overload
def bdate_range(
start: str | DateAndDatetimeLike | None = ...,
end: str | DateAndDatetimeLike | None = ...,
periods: int | None = ...,
freq: Frequency | timedelta = ...,
tz: TimeZones = ...,
normalize: bool = ...,
name: Hashable | None = ...,
weekmask: str | None = ...,
start: str | DateAndDatetimeLike | None = None,
end: str | DateAndDatetimeLike | None = None,
periods: int | None = None,
freq: Frequency | timedelta = "B",
tz: TimeZones = None,
normalize: bool = False,
name: Hashable = None,
weekmask: str | None = None,
holidays: None = None,
inclusive: IntervalClosedType = ...,
inclusive: IntervalClosedType = "both",
) -> DatetimeIndex: ...
@overload
def bdate_range(
start: str | DateAndDatetimeLike | None = ...,
end: str | DateAndDatetimeLike | None = ...,
periods: int | None = ...,
start: str | DateAndDatetimeLike | None = None,
end: str | DateAndDatetimeLike | None = None,
periods: int | None = None,
*,
freq: Frequency | timedelta,
tz: TimeZones = ...,
normalize: bool = ...,
name: Hashable | None = ...,
weekmask: str | None = ...,
tz: TimeZones = None,
normalize: bool = False,
name: Hashable = None,
weekmask: str | None = None,
holidays: Sequence[str | DateAndDatetimeLike],
inclusive: IntervalClosedType = ...,
inclusive: IntervalClosedType = "both",
) -> DatetimeIndex: ...
42 changes: 21 additions & 21 deletions pandas-stubs/core/reshape/merge.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -38,42 +38,42 @@ def merge(
def merge_ordered(
left: DataFrame,
right: DataFrame,
on: Label | list[HashableT] | None = ...,
left_on: Label | list[HashableT] | None = ...,
right_on: Label | list[HashableT] | None = ...,
left_by: Label | list[HashableT] | None = ...,
right_by: Label | list[HashableT] | None = ...,
fill_method: Literal["ffill"] | None = ...,
suffixes: Suffixes = ...,
how: JoinHow = ...,
on: Label | list[HashableT] | None = None,
left_on: Label | list[HashableT] | None = None,
right_on: Label | list[HashableT] | None = None,
left_by: Label | list[HashableT] | None = None,
right_by: Label | list[HashableT] | None = None,
fill_method: Literal["ffill"] | None = None,
suffixes: Suffixes = ("_x", "_y"),
how: JoinHow = "outer",
) -> DataFrame: ...
@overload
def merge_ordered(
left: Series,
right: DataFrame | Series,
on: Label | list[HashableT] | None = ...,
left_on: Label | list[HashableT] | None = ...,
right_on: Label | list[HashableT] | None = ...,
on: Label | list[HashableT] | None = None,
left_on: Label | list[HashableT] | None = None,
right_on: Label | list[HashableT] | None = None,
left_by: None = None,
right_by: None = None,
fill_method: Literal["ffill"] | None = ...,
fill_method: Literal["ffill"] | None = None,
suffixes: (
list[str | None] | tuple[str, str] | tuple[None, str] | tuple[str, None]
) = ...,
how: JoinHow = ...,
) = ("_x", "_y"),
how: JoinHow = "outer",
) -> DataFrame: ...
@overload
def merge_ordered(
left: DataFrame | Series,
right: Series,
on: Label | list[HashableT] | None = ...,
left_on: Label | list[HashableT] | None = ...,
right_on: Label | list[HashableT] | None = ...,
on: Label | list[HashableT] | None = None,
left_on: Label | list[HashableT] | None = None,
right_on: Label | list[HashableT] | None = None,
left_by: None = None,
right_by: None = None,
fill_method: Literal["ffill"] | None = ...,
suffixes: Suffixes = ...,
how: JoinHow = ...,
fill_method: Literal["ffill"] | None = None,
suffixes: Suffixes = ("_x", "_y"),
how: JoinHow = "outer",
) -> DataFrame: ...
def merge_asof(
left: DataFrame | Series,
Expand All @@ -86,7 +86,7 @@ def merge_asof(
by: Label | list[HashableT] | None = None,
left_by: Label | list[HashableT] | None = None,
right_by: Label | list[HashableT] | None = None,
suffixes: Suffixes = ...,
suffixes: Suffixes = ("_x", "_y"),
tolerance: int | timedelta | Timedelta | None = None,
allow_exact_matches: bool = True,
direction: Literal["backward", "forward", "nearest"] = "backward",
Expand Down
Loading