Skip to content

Commit

Permalink
fixed pivot_table sort argument in pandas_stubs (#1077)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Mariihmp authored Dec 26, 2024
1 parent 109dc86 commit f8ffb46
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions pandas-stubs/core/frame.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1295,6 +1295,7 @@ class DataFrame(NDFrame, OpsMixin):
dropna: _bool = ...,
margins_name: _str = ...,
observed: _bool = ...,
sort: _bool = ...,
) -> DataFrame: ...
@overload
def stack(
Expand Down
11 changes: 11 additions & 0 deletions tests/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -1088,6 +1088,17 @@ def test_types_pivot_table() -> None:
)


def test_pivot_table_sort():
df = pd.DataFrame({"a": [1, 2], "b": [3, 4], "c": [5, 6], "d": [7, 8]})

check(
assert_type(
df.pivot_table(values="a", index="b", columns="c", sort=True), pd.DataFrame
),
pd.DataFrame,
)


def test_types_groupby_as_index() -> None:
"""Test type of groupby.size method depending on `as_index`."""
df = pd.DataFrame({"a": [1, 2, 3]})
Expand Down

0 comments on commit f8ffb46

Please sign in to comment.