Skip to content

Commit f8ffb46

Browse files
authored
fixed pivot_table sort argument in pandas_stubs (#1077)
* fixed pivot_table sort argument in pandas_stubs * fixed pivot_table argument and test_pivot_table * replaced single-quote with double * applied pre-commit hooks formated lint code
1 parent 109dc86 commit f8ffb46

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-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 = ...,
12981299
) -> DataFrame: ...
12991300
@overload
13001301
def stack(

tests/test_frame.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,6 +1088,17 @@ def test_types_pivot_table() -> None:
10881088
)
10891089

10901090

1091+
def test_pivot_table_sort():
1092+
df = pd.DataFrame({"a": [1, 2], "b": [3, 4], "c": [5, 6], "d": [7, 8]})
1093+
1094+
check(
1095+
assert_type(
1096+
df.pivot_table(values="a", index="b", columns="c", sort=True), pd.DataFrame
1097+
),
1098+
pd.DataFrame,
1099+
)
1100+
1101+
10911102
def test_types_groupby_as_index() -> None:
10921103
"""Test type of groupby.size method depending on `as_index`."""
10931104
df = pd.DataFrame({"a": [1, 2, 3]})

0 commit comments

Comments
 (0)