Skip to content

Commit fd5e503

Browse files
committed
address more comments
1 parent e659f9e commit fd5e503

File tree

8 files changed

+103
-133
lines changed

8 files changed

+103
-133
lines changed

pandas-stubs/core/series.pyi

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -774,14 +774,14 @@ class Series(IndexOpsMixin[S1], NDFrame):
774774
def duplicated(self, keep: DropKeep = "first") -> Series[_bool]: ...
775775
def idxmax(
776776
self,
777-
axis: AxisIndex = ...,
777+
axis: AxisIndex = 0,
778778
skipna: _bool = True,
779779
*args: Any,
780780
**kwargs: Any,
781781
) -> int | _str: ...
782782
def idxmin(
783783
self,
784-
axis: AxisIndex = ...,
784+
axis: AxisIndex = 0,
785785
skipna: _bool = True,
786786
*args: Any,
787787
**kwargs: Any,
@@ -806,7 +806,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
806806
min_periods: int = ...,
807807
) -> float: ...
808808
def cov(
809-
self, other: Series[S1], min_periods: int | None = ..., ddof: int = 1
809+
self, other: Series[S1], min_periods: int | None = None, ddof: int = 1
810810
) -> float: ...
811811
@overload
812812
def diff(self: Series[_bool], periods: int = ...) -> Series[type[object]]: ... # type: ignore[overload-overlap]
@@ -932,9 +932,10 @@ class Series(IndexOpsMixin[S1], NDFrame):
932932
) -> Series[S1]: ...
933933
def argsort(
934934
self,
935-
axis: AxisIndex = ...,
935+
axis: AxisIndex = 0,
936936
kind: SortKind = "quicksort",
937-
order: None = ...,
937+
order: None = None,
938+
stable: None = None,
938939
) -> Series[int]: ...
939940
def nlargest(
940941
self, n: int = 5, keep: NsmallestNlargestKeep = "first"
@@ -943,13 +944,13 @@ class Series(IndexOpsMixin[S1], NDFrame):
943944
self, n: int = 5, keep: NsmallestNlargestKeep = "first"
944945
) -> Series[S1]: ...
945946
def swaplevel(
946-
self, i: Level = ..., j: Level = ..., copy: _bool = True
947+
self, i: Level = -2, j: Level = -1, copy: _bool = True
947948
) -> Series[S1]: ...
948949
def reorder_levels(self, order: list) -> Series[S1]: ...
949950
def explode(self) -> Series[S1]: ...
950951
def unstack(
951952
self,
952-
level: IndexLabel = ...,
953+
level: IndexLabel = -1,
953954
fill_value: int | _str | dict | None = None,
954955
sort: _bool = True,
955956
) -> DataFrame: ...
@@ -1043,10 +1044,10 @@ class Series(IndexOpsMixin[S1], NDFrame):
10431044
self,
10441045
other: DataFrame | Series,
10451046
join: JoinHow = "outer",
1046-
axis: Axis | None = None,
1047+
axis: Axis | None = 0,
10471048
level: Level | None = None,
10481049
copy: _bool = True,
1049-
fill_value: Scalar | NAType | None = ...,
1050+
fill_value: Scalar | NAType | None = None,
10501051
) -> tuple[Series, Series]: ...
10511052
@overload
10521053
def rename(
@@ -1096,10 +1097,10 @@ class Series(IndexOpsMixin[S1], NDFrame):
10961097
def reindex_like(
10971098
self,
10981099
other: Series[S1],
1099-
method: FillnaOptions | Literal["nearest"] | None = ...,
1100+
method: FillnaOptions | Literal["nearest"] | None = None,
11001101
copy: _bool = True,
11011102
limit: int | None = None,
1102-
tolerance: Scalar | AnyArrayLike | Sequence[Scalar] = ...,
1103+
tolerance: Scalar | AnyArrayLike | Sequence[Scalar] | None = None,
11031104
) -> Self: ...
11041105
@overload
11051106
def fillna(
@@ -1184,7 +1185,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
11841185
def to_timestamp(
11851186
self,
11861187
freq=...,
1187-
how: ToTimestampHow = ...,
1188+
how: ToTimestampHow = "start",
11881189
copy: _bool = True,
11891190
) -> Series[S1]: ...
11901191
def to_period(self, freq: _str | None = None, copy: _bool = True) -> DataFrame: ...
@@ -1238,19 +1239,19 @@ class Series(IndexOpsMixin[S1], NDFrame):
12381239
def add_suffix(self, suffix: _str, axis: AxisIndex | None = None) -> Series[S1]: ...
12391240
def reindex(
12401241
self,
1241-
index: Axes | None = ...,
1242-
method: ReindexMethod | None = ...,
1242+
index: Axes | None = None,
1243+
method: ReindexMethod | None = None,
12431244
copy: bool = True,
1244-
level: int | _str = ...,
1245-
fill_value: Scalar | None = ...,
1245+
level: int | _str | None = None,
1246+
fill_value: Scalar | None = None,
12461247
limit: int | None = None,
1247-
tolerance: float | None = ...,
1248+
tolerance: float | None = None,
12481249
) -> Series[S1]: ...
12491250
def filter(
12501251
self,
1251-
items: _ListLike | None = ...,
1252-
like: _str | None = ...,
1253-
regex: _str | None = ...,
1252+
items: _ListLike | None = None,
1253+
like: _str | None = None,
1254+
regex: _str | None = None,
12541255
axis: AxisIndex | None = None,
12551256
) -> Series[S1]: ...
12561257
@final
@@ -1260,11 +1261,11 @@ class Series(IndexOpsMixin[S1], NDFrame):
12601261
@final
12611262
def sample(
12621263
self,
1263-
n: int | None = ...,
1264-
frac: float | None = ...,
1264+
n: int | None = None,
1265+
frac: float | None = None,
12651266
replace: _bool = False,
1266-
weights: _str | _ListLike | np.ndarray | None = ...,
1267-
random_state: RandomState | None = ...,
1267+
weights: _str | _ListLike | np.ndarray | None = None,
1268+
random_state: RandomState | None = None,
12681269
axis: AxisIndex | None = None,
12691270
ignore_index: _bool = False,
12701271
) -> Series[S1]: ...
@@ -1441,24 +1442,25 @@ class Series(IndexOpsMixin[S1], NDFrame):
14411442
@final
14421443
def asfreq(
14431444
self,
1444-
freq,
1445+
freq: DateOffset | _str,
14451446
method: FillnaOptions | None = None,
1446-
how: Literal["start", "end"] | None = ...,
1447+
how: Literal["start", "end"] | None = None,
14471448
normalize: _bool = False,
1448-
fill_value: Scalar | None = ...,
1449+
fill_value: Scalar | None = None,
14491450
) -> Series[S1]: ...
14501451
@final
14511452
def at_time(
14521453
self,
14531454
time: _str | time,
1454-
asof: _bool = ...,
1455+
asof: _bool = False,
14551456
axis: AxisIndex | None = 0,
14561457
) -> Series[S1]: ...
14571458
@final
14581459
def between_time(
14591460
self,
14601461
start_time: _str | time,
14611462
end_time: _str | time,
1463+
inclusive: IntervalClosedType = "both",
14621464
axis: AxisIndex | None = 0,
14631465
) -> Series[S1]: ...
14641466
@final

pandas-stubs/io/formats/style.pyi

Lines changed: 44 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -101,20 +101,20 @@ class Styler(StylerRenderer):
101101
excel_writer: FilePath | WriteExcelBuffer | ExcelWriter,
102102
sheet_name: str = "Sheet1",
103103
na_rep: str = "",
104-
float_format: str | None = ...,
105-
columns: list[HashableT1] | None = ...,
104+
float_format: str | None = None,
105+
columns: list[HashableT1] | None = None,
106106
header: list[HashableT2] | bool = True,
107107
index: bool = True,
108-
index_label: IndexLabel | None = ...,
108+
index_label: IndexLabel | None = None,
109109
startrow: int = 0,
110110
startcol: int = 0,
111-
engine: Literal["openpyxl", "xlsxwriter"] | None = ...,
111+
engine: Literal["openpyxl", "xlsxwriter"] | None = None,
112112
merge_cells: ExcelWriterMergeCells = True,
113-
encoding: str | None = ...,
113+
encoding: str | None = None,
114114
inf_rep: str = "inf",
115-
verbose: bool = ...,
116-
freeze_panes: tuple[int, int] | None = ...,
117-
storage_options: StorageOptions | None = ...,
115+
verbose: bool = True,
116+
freeze_panes: tuple[int, int] | None = None,
117+
storage_options: StorageOptions | None = None,
118118
) -> None: ...
119119
@overload
120120
def to_latex(
@@ -264,15 +264,15 @@ class Styler(StylerRenderer):
264264
def set_sticky(
265265
self,
266266
axis: Axis = 0,
267-
pixel_size: int | None = ...,
268-
levels: Level | list[Level] | None = ...,
267+
pixel_size: int | None = None,
268+
levels: Level | list[Level] | None = None,
269269
) -> Styler: ...
270270
def set_table_styles(
271271
self,
272-
table_styles: dict[HashableT, CSSStyles] | CSSStyles | None = ...,
272+
table_styles: dict[HashableT, CSSStyles] | CSSStyles | None = None,
273273
axis: Axis = 0,
274274
overwrite: bool = True,
275-
css_class_names: dict[str, str] | None = ...,
275+
css_class_names: dict[str, str] | None = None,
276276
) -> Styler: ...
277277
def hide(
278278
self,
@@ -283,103 +283,101 @@ class Styler(StylerRenderer):
283283
) -> Styler: ...
284284
def background_gradient(
285285
self,
286-
cmap: str | Colormap = ...,
287-
low: float = ...,
288-
high: float = ...,
286+
cmap: str | Colormap = "PuBu",
287+
low: float = 0,
288+
high: float = 0,
289289
axis: Axis | None = 0,
290-
subset: Subset | None = ...,
291-
text_color_threshold: float = ...,
292-
vmin: float | None = ...,
293-
vmax: float | None = ...,
290+
subset: Subset | None = None,
291+
text_color_threshold: float = 0.408,
292+
vmin: float | None = None,
293+
vmax: float | None = None,
294294
gmap: (
295295
Sequence[float]
296296
| Sequence[Sequence[float]]
297297
| npt.NDArray
298298
| DataFrame
299299
| Series
300300
| None
301-
) = ...,
301+
) = None,
302302
) -> Styler: ...
303303
def text_gradient(
304304
self,
305-
cmap: str | Colormap = ...,
306-
low: float = ...,
307-
high: float = ...,
305+
cmap: str | Colormap = "PuBu",
306+
low: float = 0,
307+
high: float = 0,
308308
axis: Axis | None = 0,
309-
subset: Subset | None = ...,
310-
# In docs but not in function declaration
311-
# text_color_threshold: float
312-
vmin: float | None = ...,
313-
vmax: float | None = ...,
309+
subset: Subset | None = None,
310+
vmin: float | None = None,
311+
vmax: float | None = None,
314312
gmap: (
315313
Sequence[float]
316314
| Sequence[Sequence[float]]
317315
| npt.NDArray
318316
| DataFrame
319317
| Series
320318
| None
321-
) = ...,
319+
) = None,
322320
) -> Styler: ...
323321
def set_properties(
324322
self, subset: Subset | None = ..., **kwargs: str | int
325323
) -> Styler: ...
326324
def bar(
327325
self,
328-
subset: Subset | None = ...,
326+
subset: Subset | None = None,
329327
axis: Axis | None = 0,
330328
*,
331-
color: str | list[str] | tuple[str, str] | None = ...,
332-
cmap: str | Colormap | None = ...,
333-
width: float = ...,
334-
height: float = ...,
329+
color: str | list[str] | tuple[str, str] | None = None,
330+
cmap: str | Colormap | None = None,
331+
width: float = 100,
332+
height: float = 100,
335333
align: (
336334
Literal["left", "right", "zero", "mid", "mean"]
337335
| float
338336
| Callable[[Series | npt.NDArray | DataFrame], float]
339-
) = ...,
340-
vmin: float | None = ...,
341-
vmax: float | None = ...,
342-
props: str = ...,
337+
) = "mid",
338+
vmin: float | None = None,
339+
vmax: float | None = None,
340+
props: str = "width: 10em;",
343341
) -> Styler: ...
344342
def highlight_null(
345343
self,
346344
color: str | None = "red",
347-
subset: Subset | None = ...,
345+
subset: Subset | None = None,
348346
props: str | None = None,
349347
) -> Styler: ...
350348
def highlight_max(
351349
self,
352-
subset: Subset | None = ...,
350+
subset: Subset | None = None,
353351
color: str = "yellow",
354352
axis: Axis | None = 0,
355353
props: str | None = None,
356354
) -> Styler: ...
357355
def highlight_min(
358356
self,
359-
subset: Subset | None = ...,
357+
subset: Subset | None = None,
360358
color: str = "yellow",
361359
axis: Axis | None = 0,
362360
props: str | None = None,
363361
) -> Styler: ...
364362
def highlight_between(
365363
self,
366-
subset: Subset | None = ...,
364+
subset: Subset | None = None,
367365
color: str = "yellow",
368366
axis: Axis | None = 0,
369367
left: Scalar | list[Scalar] | None = None,
370368
right: Scalar | list[Scalar] | None = None,
371-
inclusive: IntervalClosedType = ...,
369+
inclusive: IntervalClosedType = "both",
372370
props: str | None = None,
373371
) -> Styler: ...
374372
def highlight_quantile(
375373
self,
376-
subset: Subset | None = ...,
374+
subset: Subset | None = None,
377375
color: str = "yellow",
378376
axis: Axis | None = 0,
379377
q_left: float = 0,
380378
q_right: float = 1,
381-
interpolation: QuantileInterpolation = ...,
382-
inclusive: IntervalClosedType = ...,
379+
interpolation: QuantileInterpolation = "linear",
380+
inclusive: IntervalClosedType = "both",
383381
props: str | None = None,
384382
) -> Styler: ...
385383
@classmethod

pandas-stubs/io/formats/style_render.pyi

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,26 +58,26 @@ class StylerRenderer:
5858
template_latex: Template
5959
def format(
6060
self,
61-
formatter: ExtFormatter | None = ...,
62-
subset: Subset | None = ...,
63-
na_rep: str | None = ...,
64-
precision: int | None = ...,
61+
formatter: ExtFormatter | None = None,
62+
subset: Subset | None = None,
63+
na_rep: str | None = None,
64+
precision: int | None = None,
6565
decimal: str = ".",
6666
thousands: str | None = None,
67-
escape: str | None = ...,
68-
hyperlinks: Literal["html", "latex"] | None = ...,
67+
escape: str | None = None,
68+
hyperlinks: Literal["html", "latex"] | None = None,
6969
) -> Self: ...
7070
def format_index(
7171
self,
72-
formatter: ExtFormatter | None = ...,
73-
axis: Axis = ...,
74-
level: Level | list[Level] | None = ...,
75-
na_rep: str | None = ...,
76-
precision: int | None = ...,
72+
formatter: ExtFormatter | None = None,
73+
axis: Axis = 0,
74+
level: Level | list[Level] | None = None,
75+
na_rep: str | None = None,
76+
precision: int | None = None,
7777
decimal: str = ".",
7878
thousands: str | None = None,
79-
escape: str | None = ...,
80-
hyperlinks: Literal["html", "latex"] | None = ...,
79+
escape: str | None = None,
80+
hyperlinks: Literal["html", "latex"] | None = None,
8181
) -> Self: ...
8282
def relabel_index(
8383
self,

0 commit comments

Comments
 (0)