Closed
Description
Describe the bug
From discussion here: #203 (comment)
To Reproduce
import pandas as pd
df = pd.DataFrame(
{
"Animal": ["Falcon", "Falcon", "Parrot", "Parrot"],
"Max Speed": [380, 370, 24, 26],
}
)
c: pd.Series = df.groupby("Animal")["Max Speed"].value_counts()
print(type(c)) # <class 'pandas.core.series.Series'>
print(c.index)
print(c)
mypy
and pyright
report that there is a mismatch in the result.
In pandas
source, SeriesGroupBy.value_counts()
always returns Series
. Need to make that change in typing stubs.
But should copy overloads from DataFrameGroupBy
for value_counts()
to handle normalize
argument correctly.