Skip to content

Commit bf698e2

Browse files
authored
add: literal type hints for methods in NDFrame (#52724)
* add: literal type hints * review comments
1 parent 433f34b commit bf698e2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

pandas/core/generic.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2126,7 +2126,7 @@ def to_excel(
21262126
index_label: IndexLabel = None,
21272127
startrow: int = 0,
21282128
startcol: int = 0,
2129-
engine: str | None = None,
2129+
engine: Literal["openpyxl", "xlsxwriter"] | None = None,
21302130
merge_cells: bool_t = True,
21312131
inf_rep: str = "inf",
21322132
freeze_panes: tuple[int, int] | None = None,
@@ -2273,7 +2273,8 @@ def to_excel(
22732273
def to_json(
22742274
self,
22752275
path_or_buf: FilePath | WriteBuffer[bytes] | WriteBuffer[str] | None = None,
2276-
orient: str | None = None,
2276+
orient: Literal["split", "records", "index", "table", "columns", "values"]
2277+
| None = None,
22772278
date_format: str | None = None,
22782279
double_precision: int = 10,
22792280
force_ascii: bool_t = True,
@@ -11520,7 +11521,7 @@ def rolling(
1152011521
win_type: str | None = None,
1152111522
on: str | None = None,
1152211523
axis: Axis | lib.NoDefault = lib.no_default,
11523-
closed: str | None = None,
11524+
closed: IntervalClosedType | None = None,
1152411525
step: int | None = None,
1152511526
method: str = "single",
1152611527
) -> Window | Rolling:
@@ -11579,7 +11580,7 @@ def expanding(
1157911580
self,
1158011581
min_periods: int = 1,
1158111582
axis: Axis | lib.NoDefault = lib.no_default,
11582-
method: str = "single",
11583+
method: Literal["single", "table"] = "single",
1158311584
) -> Expanding:
1158411585
if axis is not lib.no_default:
1158511586
axis = self._get_axis_number(axis)
@@ -11617,7 +11618,7 @@ def ewm(
1161711618
ignore_na: bool_t = False,
1161811619
axis: Axis | lib.NoDefault = lib.no_default,
1161911620
times: np.ndarray | DataFrame | Series | None = None,
11620-
method: str = "single",
11621+
method: Literal["single", "table"] = "single",
1162111622
) -> ExponentialMovingWindow:
1162211623
if axis is not lib.no_default:
1162311624
axis = self._get_axis_number(axis)

0 commit comments

Comments
 (0)