Skip to content

Add defaults for parameters #1293

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 23 commits into from
Aug 6, 2025
Merged
Show file tree
Hide file tree
Changes from 12 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
1 change: 0 additions & 1 deletion pandas-stubs/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ from pandas.io.api import (
read_stata as read_stata,
read_table as read_table,
read_xml as read_xml,
to_pickle as to_pickle,
)
from pandas.io.json._normalize import json_normalize as json_normalize
from pandas.tseries import offsets as offsets
Expand Down
14 changes: 13 additions & 1 deletion pandas-stubs/_libs/tslibs/timestamps.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,19 @@ class Timestamp(datetime, SupportsIndex):
) -> Timestamp: ...
def astimezone(self, tz: _tzinfo | None = ...) -> Self: ...
def ctime(self) -> str: ...
def isoformat(self, sep: str = "T", timespec: str = "auto") -> str: ...
def isoformat( # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
self,
sep: str = "T",
timespec: Literal[
"auto",
"hours",
"minutes",
"seconds",
"milliseconds",
"microseconds",
"nanoseconds",
] = "auto",
) -> str: ...
@classmethod
def strptime(cls, date_string: Never, format: Never) -> Never: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
def utcoffset(self) -> timedelta | None: ...
Expand Down
12 changes: 6 additions & 6 deletions pandas-stubs/_testing/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def assert_almost_equal(
atol: float = 1e-8,
**kwargs,
) -> None: ...
def assert_dict_equal(left: dict, right: dict, compare_keys: bool = ...) -> None: ...
def assert_dict_equal(left: dict, right: dict, compare_keys: bool = True) -> None: ...
def assert_index_equal(
left: Index,
right: Index,
Expand All @@ -55,7 +55,7 @@ def assert_index_equal(
obj: str = "Index",
) -> None: ...
def assert_class_equal(
left: T, right: T, exact: bool | Literal["equiv"] = ..., obj: str = ...
left: T, right: T, exact: bool | Literal["equiv"] = True, obj: str = "Input"
) -> None: ...
def assert_attr_equal(
attr: str, left: object, right: object, obj: str = "Attributes"
Expand All @@ -78,13 +78,13 @@ def assert_interval_array_equal(
obj: str = "IntervalArray",
) -> None: ...
def assert_period_array_equal(
left: PeriodArray, right: PeriodArray, obj: str = ...
left: PeriodArray, right: PeriodArray, obj: str = "PeriodArray"
) -> None: ...
def assert_datetime_array_equal(
left: DatetimeArray, right: DatetimeArray, check_freq: bool = ...
left: DatetimeArray, right: DatetimeArray, check_freq: bool = True
) -> None: ...
def assert_timedelta_array_equal(
left: TimedeltaArray, right: TimedeltaArray, check_freq: bool = ...
left: TimedeltaArray, right: TimedeltaArray, check_freq: bool = True
) -> None: ...
def assert_numpy_array_equal(
left,
Expand Down Expand Up @@ -185,5 +185,5 @@ def assert_produces_warning(
) -> Generator[list[warnings.WarningMessage], None, None]: ...
@contextmanager
def ensure_clean(
filename: str | None = ..., return_filelike: bool = False, **kwargs: Any
filename: str | None = None, return_filelike: bool = False, **kwargs: Any
) -> Generator[str, None, None]: ...
2 changes: 1 addition & 1 deletion pandas-stubs/core/algorithms.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def value_counts(
sort: bool = True,
ascending: bool = False,
normalize: bool = False,
bins: int | None = ...,
bins: int | None = None,
dropna: bool = True,
) -> Series: ...
def take(
Expand Down
8 changes: 4 additions & 4 deletions pandas-stubs/core/computation/eval.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ from pandas._typing import (
def eval(
expr: str | BinOp,
parser: Literal["pandas", "python"] = "pandas",
engine: Literal["python", "numexpr"] | None = "numexpr",
local_dict: dict[str, Any] | None = ...,
global_dict: dict[str, Any] | None = ...,
engine: Literal["python", "numexpr"] | None = ...,
local_dict: dict[str, Any] | None = None,
global_dict: dict[str, Any] | None = None,
resolvers: list[Mapping] | None = ...,
level: int = ...,
level: int = 0,
target: object | None = None,
inplace: bool = False,
) -> npt.NDArray | Scalar | DataFrame | Series | None: ...
2 changes: 1 addition & 1 deletion pandas-stubs/core/construction.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ from pandas.core.dtypes.dtypes import ExtensionDtype

def array(
data: Sequence[object],
dtype: str | np.dtype | ExtensionDtype | None = ...,
dtype: str | np.dtype | ExtensionDtype | None = None,
copy: bool = True,
) -> ExtensionArray: ...
87 changes: 35 additions & 52 deletions pandas-stubs/core/frame.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -476,12 +476,12 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
*,
project_id: str | None = ...,
chunksize: int | None = ...,
reauth: bool = False,
if_exists: Literal["fail", "replace", "append"] = "fail",
auth_local_webserver: bool = True,
reauth: bool = ...,
if_exists: Literal["fail", "replace", "append"] = ...,
auth_local_webserver: bool = ...,
table_schema: list[dict[str, str]] | None = ...,
location: str | None = ...,
progress_bar: bool = True,
progress_bar: bool = ...,
# Google type, not available
credentials: Any = ...,
) -> None: ...
Expand All @@ -490,10 +490,10 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
cls,
data,
index=...,
exclude=None,
columns=None,
coerce_float=False,
nrows=None,
exclude: Sequence[str] | None = None,
columns: Sequence[str] | None = None,
coerce_float: bool = False,
nrows: int | None = None,
) -> Self: ...
def to_records(
self,
Expand Down Expand Up @@ -1328,7 +1328,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
margins: _bool = False,
dropna: _bool = True,
margins_name: _str = "All",
observed: _bool = False,
observed: _bool = True,
sort: _bool = True,
) -> Self: ...
@overload
Expand All @@ -1352,7 +1352,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
def unstack(
self,
level: IndexLabel = -1,
fill_value: Scalar | None = ...,
fill_value: Scalar | None = None,
sort: _bool = True,
) -> Self | Series: ...
def melt(
Expand Down Expand Up @@ -1574,20 +1574,20 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
suffixes: Suffixes = ...,
copy: _bool = True,
indicator: _bool | _str = False,
validate: MergeValidate | None = ...,
validate: MergeValidate | None = None,
) -> Self: ...
def round(
self, decimals: int | dict | Series = ..., *args: Any, **kwargs: Any
) -> Self: ...
def corr(
self,
method: Literal["pearson", "kendall", "spearman"] = ...,
method: Literal["pearson", "kendall", "spearman"] = "pearson",
min_periods: int = ...,
numeric_only: _bool = False,
) -> Self: ...
def cov(
self,
min_periods: int | None = ...,
min_periods: int | None = None,
ddof: int = 1,
numeric_only: _bool = False,
) -> Self: ...
Expand All @@ -1599,15 +1599,8 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
method: Literal["pearson", "kendall", "spearman"] = ...,
numeric_only: _bool = False,
) -> Series: ...
@overload
def count(
self, axis: Axis = ..., numeric_only: _bool = ..., *, level: Level
) -> Self: ...
@overload
def count(
self, axis: Axis = ..., level: None = ..., numeric_only: _bool = ...
) -> Series: ...
def nunique(self, axis: Axis = 0, dropna: bool = True) -> Series: ...
def count(self, axis: Axis = 0, numeric_only: _bool = ...) -> Series[int]: ...
def nunique(self, axis: Axis = 0, dropna: bool = ...) -> Series: ...
def idxmax(
self,
axis: Axis = 0,
Expand Down Expand Up @@ -1653,7 +1646,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
) -> Self: ...
def to_period(
self,
freq: _str | None = ...,
freq: _str | None = None,
axis: Axis = 0,
copy: _bool = True,
) -> Self: ...
Expand All @@ -1662,32 +1655,32 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
def plot(self) -> PlotAccessor: ...
def hist(
self,
column: _str | list[_str] | None = ...,
by: _str | ListLike | None = ...,
column: _str | list[_str] | None = None,
by: _str | ListLike | None = None,
grid: _bool = True,
xlabelsize: float | str | None = None,
xrot: float | None = None,
ylabelsize: float | str | None = None,
yrot: float | None = None,
ax: PlotAxes | None = None,
sharex: _bool = ...,
sharex: _bool = False,
sharey: _bool = False,
figsize: tuple[float, float] | None = ...,
layout: tuple[int, int] | None = ...,
figsize: tuple[float, float] | None = None,
layout: tuple[int, int] | None = None,
bins: int | list = 10,
backend: _str | None = None,
**kwargs: Any,
): ...
def boxplot(
self,
column: _str | list[_str] | None = ...,
by: _str | ListLike | None = ...,
ax: PlotAxes | None = ...,
fontsize: float | _str | None = ...,
column: _str | list[_str] | None = None,
by: _str | ListLike | None = None,
ax: PlotAxes | None = None,
fontsize: float | _str | None = None,
rot: float = 0,
grid: _bool = True,
figsize: tuple[float, float] | None = ...,
layout: tuple[int, int] | None = ...,
figsize: tuple[float, float] | None = None,
layout: tuple[int, int] | None = None,
return_type: Literal["axes", "dict", "both"] | None = "axes",
backend: _str | None = None,
**kwargs: Any,
Expand Down Expand Up @@ -1804,14 +1797,15 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
def at_time(
self,
time: _str | dt.time,
asof: _bool = ...,
asof: _bool = False,
axis: Axis | None = 0,
) -> Self: ...
@final
def between_time(
self,
start_time: _str | dt.time,
end_time: _str | dt.time,
inclusive: IntervalClosedType = ...,
axis: Axis | None = 0,
) -> Self: ...
@overload
Expand Down Expand Up @@ -1906,28 +1900,28 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
def copy(self, deep: _bool = True) -> Self: ...
def cummax(
self,
axis: Axis | None = 0,
axis: Axis | None = None,
skipna: _bool = True,
*args: Any,
**kwargs: Any,
) -> Self: ...
def cummin(
self,
axis: Axis | None = 0,
axis: Axis | None = None,
skipna: _bool = True,
*args: Any,
**kwargs: Any,
) -> Self: ...
def cumprod(
self,
axis: Axis | None = 0,
axis: Axis | None = None,
skipna: _bool = True,
*args: Any,
**kwargs: Any,
) -> Self: ...
def cumsum(
self,
axis: Axis | None = 0,
axis: Axis | None = None,
skipna: _bool = True,
*args: Any,
**kwargs: Any,
Expand Down Expand Up @@ -2013,8 +2007,6 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
level: Level | None = ...,
fill_value: float | None = None,
) -> Self: ...
# def from_dict
# def from_records
def ge(self, other, axis: Axis = "columns", level: Level | None = ...) -> Self: ...
@overload
def get(self, key: Hashable, default: None = ...) -> Series | None: ...
Expand Down Expand Up @@ -2124,15 +2116,13 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
self,
axis: Axis | None = ...,
skipna: _bool | None = True,
level: None = ...,
numeric_only: _bool = False,
**kwargs: Any,
) -> Series: ...
def min(
self,
axis: Axis | None = ...,
skipna: _bool | None = True,
level: None = ...,
numeric_only: _bool = False,
**kwargs: Any,
) -> Series: ...
Expand Down Expand Up @@ -2178,7 +2168,6 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
self,
axis: Axis | None = ...,
skipna: _bool | None = True,
level: None = ...,
numeric_only: _bool = False,
min_count: int = 0,
**kwargs: Any,
Expand All @@ -2187,7 +2176,6 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
self,
axis: Axis | None = ...,
skipna: _bool = True,
level: None = ...,
numeric_only: _bool = False,
min_count: int = 0,
**kwargs: Any,
Expand Down Expand Up @@ -2350,7 +2338,6 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
self,
axis: Axis | None = ...,
skipna: _bool | None = True,
level: None = ...,
ddof: int = 1,
numeric_only: _bool = False,
**kwargs: Any,
Expand All @@ -2361,7 +2348,6 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
self,
axis: Axis | None = ...,
skipna: _bool | None = True,
level: None = ...,
numeric_only: _bool = False,
**kwargs: Any,
) -> Series: ...
Expand All @@ -2371,7 +2357,6 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
self,
axis: Axis = ...,
skipna: _bool = True,
level: None = ...,
ddof: int = 1,
numeric_only: _bool = False,
**kwargs: Any,
Expand All @@ -2392,9 +2377,8 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
) -> Self: ...
def sum(
self,
axis: Axis | None = ...,
axis: Axis = ...,
skipna: _bool | None = True,
level: None = ...,
numeric_only: _bool = False,
min_count: int = 0,
**kwargs: Any,
Expand Down Expand Up @@ -2560,9 +2544,8 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
) -> Self: ...
def var(
self,
axis: Axis | None = ...,
axis: Axis = ...,
skipna: _bool | None = True,
level: None = ...,
ddof: int = 1,
numeric_only: _bool = False,
**kwargs: Any,
Expand Down
Loading
Loading