bach.DataFrame.groupby

groupby​

(by=None)

​[source]

Group by any of the series currently in this DataDrame, both from index as well as data.

Parameters​

by (Optional[Union[str, Series, Tuple[Union[str, Series, Tuple[Union[str, Series], ...]], ...], Sequence[Union[str, Series, List[Union[str, Series]], Tuple[Union[str, Series], ...]]]]]) – The series to group by. Supported are:

  • a string containing a columnn name.
  • a series.
  • a list of strings or series. A normal group by will be created.
  • a list of (strings, series, lists). In this case a grouping list is created.
  • a tuple of (strings, series, lists). In this case a grouping set is created.

Returns​

a new DataFrame object with the group_by attribute set.

Return type​

DataFrame

note

If the dataframe is already grouped, we’ll create a grouping list from the initial grouping combined with this one.