Skip to content

Commit 0f70c14

Browse files
committed
fixed pivot_table sort argument in pandas_stubs
1 parent 109dc86 commit 0f70c14

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

pandas-stubs/core/frame.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,6 +1295,7 @@ class DataFrame(NDFrame, OpsMixin):
12951295
dropna: _bool = ...,
12961296
margins_name: _str = ...,
12971297
observed: _bool = ...,
1298+
sort: _bool = True,
12981299
) -> DataFrame: ...
12991300
@overload
13001301
def stack(

tests/test_frame.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,6 +1087,16 @@ def test_types_pivot_table() -> None:
10871087
pd.DataFrame,
10881088
)
10891089

1090+
def test_pivot_table_sort():
1091+
df = DataFrame(
1092+
{'a': [1, 2],
1093+
'b': [3, 4],
1094+
'c': [5, 6],
1095+
'd': [7, 8]}
1096+
)
1097+
result = df.pivot_table(values='a', index='b', columns='c', sort=True)
1098+
assert result is not None
1099+
10901100

10911101
def test_types_groupby_as_index() -> None:
10921102
"""Test type of groupby.size method depending on `as_index`."""

0 commit comments

Comments
 (0)