Closed
Description
Describe the bug
The values
argument of the pandas.DataFrame.pivot_table
method has type of str | None
:
pandas-stubs/pandas-stubs/core/frame.pyi
Lines 1126 to 1137 in 7dd7b6a
But the Pandas documentation says that values
may have not only a string value, but also a list-like value:
Docs of pandas.DataFrame.pivot_table
To Reproduce
- 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'],
)
- I am using
mypy
. - The error message received from
mypy
:
error: Argument "values" to "pivot_table" of "DataFrame" has incompatible type "list[str]"; expected "str | None" [arg-type]
Found 1 error in 1 file (checked 80 source files)
Please complete the following information:
- OS: Ubuntu
- OS version: 23.10
python
version: 3.10.11mypy
version: 1.8.0pandas-stubs
version: 2.2.0.240218