swnn.group_mean

swnn.group_mean(X, labels, binary=False, classes=None, features=None, print_groups=True)

This function may work with more efficiency than df.groupby().mean() when handling sparse matrix.

Parameters
  • X (shape (n_samples, n_features)) –

  • labels (shape (n_samples, )) –

  • classes (optional) – names of groups

  • features (optional) – names of features

  • print_groups (bool) – whether to inspect the groups