diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 582a043a8a78a..dc54a6fa7fc72 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -2125,7 +2125,7 @@ def to_excel( index_label: IndexLabel = None, startrow: int = 0, startcol: int = 0, - engine: str | None = None, + engine: Literal["openpyxl", "xlsxwriter"] | None = None, merge_cells: bool_t = True, inf_rep: str = "inf", freeze_panes: tuple[int, int] | None = None, @@ -2272,7 +2272,8 @@ def to_excel( def to_json( self, path_or_buf: FilePath | WriteBuffer[bytes] | WriteBuffer[str] | None = None, - orient: str | None = None, + orient: Literal["split", "records", "index", "table", "columns", "values"] + | None = None, date_format: str | None = None, double_precision: int = 10, force_ascii: bool_t = True, @@ -11499,7 +11500,7 @@ def rolling( win_type: str | None = None, on: str | None = None, axis: Axis | lib.NoDefault = lib.no_default, - closed: str | None = None, + closed: IntervalClosedType | None = None, step: int | None = None, method: str = "single", ) -> Window | Rolling: @@ -11558,7 +11559,7 @@ def expanding( self, min_periods: int = 1, axis: Axis | lib.NoDefault = lib.no_default, - method: str = "single", + method: Literal["single", "table"] = "single", ) -> Expanding: if axis is not lib.no_default: axis = self._get_axis_number(axis) @@ -11596,7 +11597,7 @@ def ewm( ignore_na: bool_t = False, axis: Axis | lib.NoDefault = lib.no_default, times: np.ndarray | DataFrame | Series | None = None, - method: str = "single", + method: Literal["single", "table"] = "single", ) -> ExponentialMovingWindow: if axis is not lib.no_default: axis = self._get_axis_number(axis)