Skip to content
New: Star-import, signal unraveling, Python 3.12 support, and more

#
nb module

Numba-compiled functions for grouping.

## get_group_lens_nb function

    get_group_lens_nb(
        groups
    )

Return the count per group.

Note

Columns must form monolithic, sorted groups. For unsorted groups, use get_group_map_nb().

## get_group_map_nb function

    get_group_map_nb(
        groups,
        n_groups
    )

Build the map between groups and indices.

Returns an array with indices segmented by group and an array with group lengths.

Works well for unsorted group arrays.

## get_groups_and_index function

    get_groups_and_index(
        index,
        group_by
    )

Return array of group indices pointing to the original index, and grouped index.

## group_by_evenly_nb function

    group_by_evenly_nb(
        n,
        n_splits
    )

Get `group_by` from evenly splitting a space of values.

## group_by_to_index function

    group_by_to_index(
        index,
        group_by
    )

Convert mapper `group_by` to `pd.Index`.

Note

Index and mapper must have the same length.

## group_lens_select_nb function

    group_lens_select_nb(
        group_lens,
        new_groups
    )

Perform indexing on a sorted array using group lengths.

Returns indices of elements corresponding to groups in `new_groups` and a new group array.

## group_map_select_nb function

    group_map_select_nb(
        group_map,
        new_groups
    )

Perform indexing using group map.

#### Cookie consent

We use cookies to recognize your repeated visits and preferences, as well as to measure the effectiveness of our documentation and whether users find what they're searching for. With your consent, you're helping us to make our documentation better.

- Google Analytics
- GitHub

Manage settings