Skip to content

TYP: misc #47509

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 4 commits into from
Jun 28, 2022
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
2 changes: 1 addition & 1 deletion pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -5545,7 +5545,7 @@ def replace(
inplace: bool = False,
limit=None,
regex: bool = False,
method: str | lib.NoDefault = lib.no_default,
method: Literal["pad", "ffill", "bfill"] | lib.NoDefault = lib.no_default,
):
return super().replace(
to_replace=to_replace,
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -6608,7 +6608,7 @@ def replace(
inplace: bool_t = False,
limit: int | None = None,
regex=False,
method=lib.no_default,
method: Literal["pad", "ffill", "bfill"] | lib.NoDefault = lib.no_default,
):
if not (
is_scalar(to_replace)
Expand Down
7 changes: 5 additions & 2 deletions pandas/core/indexes/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2643,7 +2643,10 @@ def _get_indexer_level_0(self, target) -> npt.NDArray[np.intp]:
return ci.get_indexer_for(target)

def get_slice_bound(
self, label: Hashable | Sequence[Hashable], side: str, kind=lib.no_default
self,
label: Hashable | Sequence[Hashable],
side: Literal["left", "right"],
kind=lib.no_default,
) -> int:
"""
For an ordered MultiIndex, compute slice bound
Expand Down Expand Up @@ -2758,7 +2761,7 @@ def slice_locs(
# happens in get_slice_bound method), but it adds meaningful doc.
return super().slice_locs(start, end, step)

def _partial_tup_index(self, tup: tuple, side="left"):
def _partial_tup_index(self, tup: tuple, side: Literal["left", "right"] = "left"):
if len(tup) > self._lexsort_depth:
raise UnsortedIndexError(
f"Key length ({len(tup)}) was greater than MultiIndex lexsort depth "
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -5204,7 +5204,7 @@ def replace(
inplace=False,
limit=None,
regex=False,
method: str | lib.NoDefault = lib.no_default,
method: Literal["pad", "ffill", "bfill"] | lib.NoDefault = lib.no_default,
):
return super().replace(
to_replace=to_replace,
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/shared_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@
string. Alternatively, this could be a regular expression or a
list, dict, or array of regular expressions in which case
`to_replace` must be ``None``.
method : {{'pad', 'ffill', 'bfill', `None`}}
method : {{'pad', 'ffill', 'bfill'}}
The method to use when for replacement, when `to_replace` is a
scalar, list or tuple and `value` is ``None``.

Expand Down
3 changes: 2 additions & 1 deletion pandas/core/window/expanding.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

from pandas._typing import (
Axis,
QuantileInterpolation,
WindowingRankType,
)

Expand Down Expand Up @@ -651,7 +652,7 @@ def kurt(self, numeric_only: bool = False, **kwargs):
def quantile(
self,
quantile: float,
interpolation: str = "linear",
interpolation: QuantileInterpolation = "linear",
numeric_only: bool = False,
**kwargs,
):
Expand Down
5 changes: 3 additions & 2 deletions pandas/core/window/rolling.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
ArrayLike,
Axis,
NDFrameT,
QuantileInterpolation,
WindowingRankType,
)
from pandas.compat._optional import import_optional_dependency
Expand Down Expand Up @@ -1658,7 +1659,7 @@ def kurt(self, numeric_only: bool = False, **kwargs):
def quantile(
self,
quantile: float,
interpolation: str = "linear",
interpolation: QuantileInterpolation = "linear",
numeric_only: bool = False,
**kwargs,
):
Expand Down Expand Up @@ -2553,7 +2554,7 @@ def kurt(self, numeric_only: bool = False, **kwargs):
def quantile(
self,
quantile: float,
interpolation: str = "linear",
interpolation: QuantileInterpolation = "linear",
numeric_only: bool = False,
**kwargs,
):
Expand Down