skillfed

numpy-groupies

Optimised tools for group-indexing operations: aggregated sum and more.

numpy-groupies v0.11.3 357.0K downloads/30d#7,276 on PyPI210
Permissive license Copyright (c) 2016, numpy-groupies developers All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following… (full text in the JSON record) Active released

What it is and what it does

numpy-groupies provides a small library of optimized tools for group-indexing operations on arrays. The core function, `aggregate`, takes an array of values and an array of group labels, then computes a reduction (sum, mean, standard deviation, min, max, or custom function) for each group. It also supports cumulative operations like cumsum and cumprod that preserve the input size, and boolean aggregations like 'all' and 'any'.

The package is conceptually similar to pandas groupby, MATLAB's accumarray, or the MapReduce paradigm. It handles various input shapes: 1D arrays with matching group indices, multidimensional arrays with axis-specific grouping, and 2D group index arrays for complex grouping patterns. The implementation is pure Python with numpy as an optional dependency, making it lightweight and easy to install.

Use it for:

  • Compute statistics (sum, mean, variance) for data points belonging to labeled groups without loading a full dataframe library
  • Build histograms or frequency counts by aggregating values into bins defined by group indices
  • Perform cumulative operations within groups (e.g., running sum per group) while preserving input array size
  • Aggregate multidimensional scientific data along a specific axis by group membership
  • Handle NaN values selectively using nan-aware aggregation functions (nansum, nanmean, etc.)

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides optimized group-indexing operations on arrays, with `aggregate` as the primary tool for computing reductions (sum, mean, std, etc.) across labeled groups of values.

Yes. Low install friction, no mandatory dependencies, active maintenance, permissive license, and a focused API for group aggregation operations. Install if you need group-based array reductions without the overhead of pandas or other dataframe libraries. The 449-day gap since last release is notable but not disqualifying given the active repository and stable API.

Install

numpy-groupies on PyPI

pip

pip install numpy-groupies

uv

uv add numpy-groupies

poetry

poetry add numpy-groupies

Installing numpy-groupies

Before you install

Low friction: pure Python wheel with only numpy as an optional runtime dependency. Last release 449 days ago; repository active with recent commits and 210 stars.

License in practice

BSD 2-Clause permissive license. No restrictions on commercial or private use; redistribution requires retaining copyright notice and disclaimer.

Quickstart

pip install numpy_groupies

import numpy as np
import numpy_groupies as npg

group_idx = np.array([3, 0, 0, 1, 0, 3, 5, 5, 0, 4])
a = np.array([13.2, 3.5, 3.5, -8.2, 3.0, 13.4, 99.2, -7.1, 0.0, 53.7])
result = npg.aggregate(group_idx, a, func='sum', fill_value=0)

Verify before relying

  • Whether all aggregation functions (sum, mean, std, min, max, etc.) are available in all backends or only in specific implementations
  • Performance characteristics and memory usage for large arrays or many groups
  • Whether the package is actively maintained or in maintenance-only mode given the 449-day gap since last release

Package facts

License Copyright (c) 2016, numpy-groupies developers All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following… (full text in the JSON record) (permissive)
Python support supports the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies 1 — numpy
Maintenance actively maintained — 449 days since the last release
Last repo commit
First released
Downloads 357,042/month — #7,276 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: numpy_groupies-0.11.3-py3-none-any.whl

Keywords: accumarray, aggregate, groupby, grouping, indexing

Development Status :: 4 - BetaIntended Audience :: DevelopersIntended Audience :: Science/ResearchLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.9Topic :: Scientific/EngineeringTopic :: Software Development :: Libraries

Tags

group aggregation numpyaccumarray pythongroupby operations arraysgroup indexing reductionnumpy aggregate by groupcumulative group operationslabeled array reduction
array-aggregationgroup-operationsscientific-computing

More Libraries packages