Skip to content

Missing parameter for the sort argument of the pandas.DataFrame.pivot_table method #1076

Closed
@zepaz

Description

@zepaz

Missing parameter for the sort argument of the pandas.DataFrame.pivot_table method

Describe the bug The sort argument of the pandas.DataFrame.pivot_table method is available, but according to the pandas-stubs it is not:

def pivot_table(
self,
values: _str | None = ...,
index: _str | Grouper | Sequence | None = ...,
columns: _str | Grouper | Sequence | None = ...,
aggfunc=...,
fill_value: Scalar | None = ...,
margins: _bool = ...,
dropna: _bool = ...,
margins_name: _str = ...,
observed: _bool = ...,
) -> DataFrame: ...

The Pandas documentation says that sort is an available parameter: Docs of pandas.DataFrame.pivot_table

sort bool, default True
    Specifies if the result should be sorted.
    New in version 1.3.0.

To Reproduce
1. A minimal runnable pandas example that is not properly checked by the stubs:

from pandas import DataFrame

data_frame = DataFrame({
    'a': [1, 2],
    'b': [1, 2],
    'c': [1, 2],
    'd': [1, 2],
})
data_frame.pivot_table(
    values=['a', 'b'],
    index=['c', 'd'],
	sort=True,
)
3. I am using `pyright`.

4. The error message received from `pyright`:
9 - error: No parameter named "sort" (reportCallIssue)

Please complete the following information:
* OS: Windows
* OS version: 10
* python version: 3.12.1
* pyright version: 1.1.391
* pandas-stubs version: 2.2.3.241126

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions