Skip to content

Commit

Permalink
Remove default values and deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
hamdanal committed Jan 13, 2024
1 parent 0ec4cbc commit fce36b6
Show file tree
Hide file tree
Showing 15 changed files with 510 additions and 528 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ repos:
--exit-non-zero-on-fix,
--target-version, py39,
--extend-select, "PYI,UP,RUF100",
--ignore, "E501,E731,F841,PYI042,PYI053",
--ignore, "E501,E731,F841,PYI042",
--per-file-ignores, "_*.pyi:PYI001",
--fix
]
Expand Down
18 changes: 9 additions & 9 deletions pandas-stubs/core/apply.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ ResType = dict[int, Any] # noqa: PYI026
def frame_apply(
obj: DataFrame,
func: AggFuncType,
axis: Axis = 0,
raw: bool = False,
result_type: str | None = None,
by_row: Literal[False, "compat"] = "compat",
args=None,
kwargs=None,
axis: Axis = ...,
raw: bool = ...,
result_type: str | None = ...,
by_row: Literal[False, "compat"] = ...,
args=...,
kwargs=...,
) -> FrameApply: ...

class Apply(Generic[_AggObjT], metaclass=abc.ABCMeta):
Expand All @@ -72,7 +72,7 @@ class Apply(Generic[_AggObjT], metaclass=abc.ABCMeta):
raw: bool,
result_type: Literal["reduce", "broadcast", "expand"] | None,
*,
by_row: Literal[False, "compat", "_compat"] = "compat",
by_row: Literal[False, "compat", "_compat"] = ...,
args,
kwargs,
) -> None: ...
Expand Down Expand Up @@ -132,7 +132,7 @@ class FrameApply(NDFrameApply[DataFrame]):
raw: bool,
result_type: Literal["reduce", "broadcast", "expand"] | None,
*,
by_row: Literal[False, "compat"] = False,
by_row: Literal[False, "compat"] = ...,
args,
kwargs,
) -> None: ...
Expand Down Expand Up @@ -192,7 +192,7 @@ class SeriesApply(NDFrameApply[Series]):
func: AggFuncType,
*,
convert_dtype: bool | NoDefault = ...,
by_row: Literal[False, "compat", "_compat"] = "compat",
by_row: Literal[False, "compat", "_compat"] = ...,
args,
kwargs,
) -> None: ...
Expand Down
18 changes: 9 additions & 9 deletions pandas-stubs/core/generic.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -444,15 +444,15 @@ class NDFrame(indexing.IndexingMixin):
self,
rule: Frequency,
axis: Axis | NoDefault = ...,
closed: Literal["right", "left"] | None = None,
label: Literal["right", "left"] | None = None,
convention: TimestampConvention = "start",
kind: Literal["period", "timestamp", "timedelta"] | None = None,
on: Level | None = None,
level: Level | None = None,
origin: TimeGrouperOrigin | TimestampConvertibleTypes = "start_day",
offset: TimedeltaConvertibleTypes | None = None,
group_keys: _bool = False,
closed: Literal["right", "left"] | None = ...,
label: Literal["right", "left"] | None = ...,
convention: TimestampConvention = ...,
kind: Literal["period", "timestamp", "timedelta"] | None = ...,
on: Level | None = ...,
level: Level | None = ...,
origin: TimeGrouperOrigin | TimestampConvertibleTypes = ...,
offset: TimedeltaConvertibleTypes | None = ...,
group_keys: _bool = ...,
) -> DatetimeIndexResampler[Self]: ...
def first(self, offset) -> Self: ...
def last(self, offset) -> Self: ...
Expand Down
178 changes: 89 additions & 89 deletions pandas-stubs/core/groupby/generic.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -64,65 +64,65 @@ class SeriesGroupBy(GroupBy[Series[S1]], Generic[S1, ByT]):
self,
func: list[AggFuncTypeBase],
*args,
engine: WindowingEngine = None,
engine_kwargs: WindowingEngineKwargs = None,
engine: WindowingEngine = ...,
engine_kwargs: WindowingEngineKwargs = ...,
**kwargs,
) -> DataFrame: ...
@overload
def aggregate(
self,
func: AggFuncTypeBase | None = None,
func: AggFuncTypeBase | None = ...,
*args,
engine: WindowingEngine = None,
engine_kwargs: WindowingEngineKwargs = None,
engine: WindowingEngine = ...,
engine_kwargs: WindowingEngineKwargs = ...,
**kwargs,
) -> Series: ...
agg = aggregate
def transform(
self,
func: Callable | str,
*args,
engine: WindowingEngine = None,
engine_kwargs: WindowingEngineKwargs = None,
engine: WindowingEngine = ...,
engine_kwargs: WindowingEngineKwargs = ...,
**kwargs,
) -> Series: ...
def filter(
self, func: Callable | str, dropna: bool = True, *args, **kwargs
self, func: Callable | str, dropna: bool = ..., *args, **kwargs
) -> Series: ...
def nunique(self, dropna: bool = True) -> Series[int]: ...
def nunique(self, dropna: bool = ...) -> Series[int]: ...
# describe delegates to super() method but here it has keyword-only parameters
def describe( # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
self,
*,
percentiles: Iterable[float] | None = None,
include: Literal["all"] | list[Dtype] | None = None,
exclude: list[Dtype] | None = None,
percentiles: Iterable[float] | None = ...,
include: Literal["all"] | list[Dtype] | None = ...,
exclude: list[Dtype] | None = ...,
) -> DataFrame: ...
@overload
def value_counts(
self,
normalize: Literal[False] = False,
sort: bool = True,
ascending: bool = False,
bins=None,
dropna: bool = True,
normalize: Literal[False] = ...,
sort: bool = ...,
ascending: bool = ...,
bins=...,
dropna: bool = ...,
) -> Series[int]: ...
@overload
def value_counts(
self,
normalize: Literal[True],
sort: bool = True,
ascending: bool = False,
bins=None,
dropna: bool = True,
sort: bool = ...,
ascending: bool = ...,
bins=...,
dropna: bool = ...,
) -> Series[float]: ...
def fillna(
self,
value: object | ArrayLike | None = None,
method: FillnaOptions | None = None,
value: object | ArrayLike | None = ...,
method: FillnaOptions | None = ...,
axis: Axis | None | NoDefault = ...,
inplace: bool = False,
limit: int | None = None,
inplace: bool = ...,
limit: int | None = ...,
downcast: dict | None | NoDefault = ...,
) -> Series[S1] | None: ...
def take(
Expand All @@ -134,46 +134,46 @@ class SeriesGroupBy(GroupBy[Series[S1]], Generic[S1, ByT]):
def skew(
self,
axis: Axis | NoDefault = ...,
skipna: bool = True,
numeric_only: bool = False,
skipna: bool = ...,
numeric_only: bool = ...,
**kwargs,
) -> Series: ...
@property
def plot(self) -> GroupByPlot[Self]: ...
def nlargest(
self, n: int = 5, keep: Literal["first", "last", "all"] = "first"
self, n: int = ..., keep: Literal["first", "last", "all"] = ...
) -> Series[S1]: ...
def nsmallest(
self, n: int = 5, keep: Literal["first", "last", "all"] = "first"
self, n: int = ..., keep: Literal["first", "last", "all"] = ...
) -> Series[S1]: ...
def idxmin(self, axis: Axis | NoDefault = ..., skipna: bool = True) -> Series: ...
def idxmax(self, axis: Axis | NoDefault = ..., skipna: bool = True) -> Series: ...
def idxmin(self, axis: Axis | NoDefault = ..., skipna: bool = ...) -> Series: ...
def idxmax(self, axis: Axis | NoDefault = ..., skipna: bool = ...) -> Series: ...
def corr(
self,
other: Series,
method: CorrelationMethod = "pearson",
min_periods: int | None = None,
method: CorrelationMethod = ...,
min_periods: int | None = ...,
) -> Series: ...
def cov(
self, other: Series, min_periods: int | None = None, ddof: int | None = 1
self, other: Series, min_periods: int | None = ..., ddof: int | None = ...
) -> Series: ...
@property
def is_monotonic_increasing(self) -> Series[bool]: ...
@property
def is_monotonic_decreasing(self) -> Series[bool]: ...
def hist(
self,
by: IndexLabel | None = None,
ax: PlotAxes | None = None,
grid: bool = True,
xlabelsize: float | None = None,
xrot: float | None = None,
ylabelsize: float | None = None,
yrot: float | None = None,
figsize: tuple[float, float] | None = None,
bins: int | Sequence[int] = 10,
backend: str | None = None,
legend: bool = False,
by: IndexLabel | None = ...,
ax: PlotAxes | None = ...,
grid: bool = ...,
xlabelsize: float | None = ...,
xrot: float | None = ...,
ylabelsize: float | None = ...,
yrot: float | None = ...,
figsize: tuple[float, float] | None = ...,
bins: int | Sequence[int] = ...,
backend: str | None = ...,
legend: bool = ...,
**kwargs,
) -> Series: ... # Series[Axes] but this is not allowed
@property
Expand Down Expand Up @@ -212,23 +212,23 @@ class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT]):
@overload
def aggregate(
self,
func: AggFuncTypeFrame | None = None,
func: AggFuncTypeFrame | None = ...,
*args,
engine: WindowingEngine = None,
engine_kwargs: WindowingEngineKwargs = None,
engine: WindowingEngine = ...,
engine_kwargs: WindowingEngineKwargs = ...,
**kwargs,
) -> DataFrame: ...
agg = aggregate
def transform(
self,
func: Callable | str,
*args,
engine: WindowingEngine = None,
engine_kwargs: WindowingEngineKwargs = None,
engine: WindowingEngine = ...,
engine_kwargs: WindowingEngineKwargs = ...,
**kwargs,
) -> DataFrame: ...
def filter(
self, func: Callable, dropna: bool = True, *args, **kwargs
self, func: Callable, dropna: bool = ..., *args, **kwargs
) -> DataFrame: ...
@overload
def __getitem__( # type: ignore[overload-overlap]
Expand All @@ -238,18 +238,18 @@ class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT]):
def __getitem__( # pyright: ignore[reportIncompatibleMethodOverride]
self, key: Iterable[Hashable] | slice
) -> DataFrameGroupBy[ByT]: ...
def nunique(self, dropna: bool = True) -> DataFrame: ...
def nunique(self, dropna: bool = ...) -> DataFrame: ...
def idxmax(
self,
axis: Axis | None | NoDefault = ...,
skipna: bool = True,
numeric_only: bool = False,
skipna: bool = ...,
numeric_only: bool = ...,
) -> DataFrame: ...
def idxmin(
self,
axis: Axis | None | NoDefault = ...,
skipna: bool = True,
numeric_only: bool = False,
skipna: bool = ...,
numeric_only: bool = ...,
) -> DataFrame: ...
boxplot = boxplot_frame_groupby
@overload
Expand All @@ -272,11 +272,11 @@ class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT]):
) -> Series[float]: ...
def fillna(
self,
value: Hashable | Mapping | Series | DataFrame | None = None,
method: FillnaOptions | None = None,
value: Hashable | Mapping | Series | DataFrame | None = ...,
method: FillnaOptions | None = ...,
axis: Axis | None | NoDefault = ...,
inplace: Literal[False] = False,
limit: int | None = None,
inplace: Literal[False] = ...,
limit: int | None = ...,
downcast: dict | None | NoDefault = ...,
) -> DataFrame: ...
def take(
Expand All @@ -286,8 +286,8 @@ class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT]):
def skew( # type: ignore[overload-overlap]
self,
axis: Axis | None | NoDefault = ...,
skipna: bool = True,
numeric_only: bool = False,
skipna: bool = ...,
numeric_only: bool = ...,
*,
level: Level,
**kwargs,
Expand All @@ -296,43 +296,43 @@ class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT]):
def skew(
self,
axis: Axis | None | NoDefault = ...,
skipna: bool = True,
numeric_only: bool = False,
skipna: bool = ...,
numeric_only: bool = ...,
*,
level: None = None,
level: None = ...,
**kwargs,
) -> Series: ...
@property
def plot(self) -> GroupByPlot[Self]: ...
def corr(
self,
method: str | Callable[[np.ndarray, np.ndarray], float] = "pearson",
min_periods: int = 1,
numeric_only: bool = False,
method: str | Callable[[np.ndarray, np.ndarray], float] = ...,
min_periods: int = ...,
numeric_only: bool = ...,
) -> DataFrame: ...
def cov(
self,
min_periods: int | None = None,
ddof: int | None = 1,
numeric_only: bool = False,
min_periods: int | None = ...,
ddof: int | None = ...,
numeric_only: bool = ...,
) -> DataFrame: ...
def hist(
self,
column: IndexLabel | None = None,
by: IndexLabel | None = None,
grid: bool = True,
xlabelsize: float | None = None,
xrot: float | None = None,
ylabelsize: float | None = None,
yrot: float | None = None,
ax: PlotAxes | None = None,
sharex: bool = False,
sharey: bool = False,
figsize: tuple[float, float] | None = None,
layout: tuple[int, int] | None = None,
bins: int | Sequence[int] = 10,
backend: str | None = None,
legend: bool = False,
column: IndexLabel | None = ...,
by: IndexLabel | None = ...,
grid: bool = ...,
xlabelsize: float | None = ...,
xrot: float | None = ...,
ylabelsize: float | None = ...,
yrot: float | None = ...,
ax: PlotAxes | None = ...,
sharex: bool = ...,
sharey: bool = ...,
figsize: tuple[float, float] | None = ...,
layout: tuple[int, int] | None = ...,
bins: int | Sequence[int] = ...,
backend: str | None = ...,
legend: bool = ...,
**kwargs,
) -> Series: ... # Series[Axes] but this is not allowed
@property
Expand All @@ -341,9 +341,9 @@ class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT]):
self,
other: DataFrame | Series,
axis: Axis | NoDefault = ...,
drop: bool = False,
method: CorrelationMethod = "pearson",
numeric_only: bool = False,
drop: bool = ...,
method: CorrelationMethod = ...,
numeric_only: bool = ...,
) -> DataFrame: ...
def __getattr__(self, name: str) -> SeriesGroupBy[Any, ByT]: ...
# Overrides that provide more precise return types over the GroupBy class
Expand Down
Loading

0 comments on commit fce36b6

Please sign in to comment.