Open beckernick opened 6 months ago
It appears that groupby.value_counts
is only properly implemented for DataFrameGroupby
. In pandas value_counts
has a different signature depending on whether the resulting grouped object is a Series or DataFrame.
# DataFrameGroupby
def value_counts(
self,
subset: Sequence[Hashable] | None = None,
normalize: bool = False,
sort: bool = True,
ascending: bool = False,
dropna: bool = True,
) -> DataFrame | Series:
# SeriesGroupby
def value_counts(
self,
normalize: bool = False,
sort: bool = True,
ascending: bool = False,
bins=None,
dropna: bool = True,
) -> Series | DataFrame:
Groupby value_counts fails on when selecting individual columns from a DataFrame, but succeeds when running on the entire DataFrame.