skillfed

xarray-einstats

Stats, linear algebra and einops for xarray

xarray-einstats v0.11.0 2.2M downloads/30d#3,235 on PyPI68
Permissive license Active released

What it is and what it does

xarray-einstats bridges the gap between xarray's labeled array clarity and NumPy/SciPy's functional depth. When xarray operations become verbose or when you need linear algebra or statistical functions, this package provides thin wrappers that preserve dimension names and coordinate information instead of forcing you back to positional indexing. It wraps numpy.linalg and scipy.stats functions, plus einops tensor operations, with an API designed for xarray's labeled semantics.

The package targets scientific and statistical workflows where you work with multi-dimensional data and want to perform matrix operations or statistical tests without losing your dimension labels. It's in active development (Alpha status) and maintained as part of the ArviZ ecosystem.

Use it for:

  • Compute matrix decompositions on xarray variables while preserving dimension names
  • Apply scipy.stats functions to labeled multi-dimensional arrays without reshaping to NumPy
  • Reshape and transpose xarray data using einops syntax adapted for labeled dimensions
  • Perform linear algebra on Bayesian posterior samples organized by chain and draw dimensions
  • Stack or reshape dimensions in scientific datasets while maintaining coordinate metadata

Worth the install?

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

Provides xarray-friendly wrappers around NumPy linear algebra, SciPy statistics, and einops operations, reducing verbosity while preserving labeled array semantics.

Yes, if you regularly work with xarray and need NumPy linear algebra or SciPy statistics without losing dimension labels. Low install friction, active maintenance, permissive license, and no known vulnerabilities. Alpha status means the API may evolve, but it's suitable for workflows where clarity and labeled semantics matter more than API stability guarantees.

Install

xarray-einstats on PyPI

pip

pip install xarray-einstats

uv

uv add xarray-einstats

poetry

poetry add xarray-einstats

Installing xarray-einstats

Before you install

Low friction: pure Python wheel with only three runtime dependencies (numpy, scipy, xarray). Last release 25 days ago; repository active with recent commits.

License in practice

Permissive license allows commercial and private use with minimal restrictions.

Quickstart

pip install xarray-einstats

import xarray as xr
import xarray_einstats

# Use wrapped functions on xarray DataArrays
da = xr.DataArray(...)
result = xarray_einstats.linalg.svd(da)

Requires Python 3.12 or later.

Verify before relying

  • Whether einops is an optional or required transitive dependency (not listed in runtime deps)
  • Scope and maturity of scipy.stats wrapper coverage
  • Performance characteristics vs. direct numpy/scipy calls

Package facts

License not declared (permissive)
Python support supports the current Python release (>=3.12)
Install friction low — pure-Python wheel
Runtime dependencies 3 — numpy, scipy, xarray
Maintenance actively maintained — 25 days since the last release
Last repo commit
First released
Downloads 2,165,943/month — #3,235 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: xarray_einstats-0.11.0-py3-none-any.whl

Development Status :: 3 - AlphaIntended Audience :: DevelopersIntended Audience :: EducationIntended Audience :: Science/ResearchLicense :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14

Tags

xarray linear algebra wrapperseinops for xarrayscipy stats with xarraynumpy linalg xarraylabeled array operationsxarray matrix operationsscientific computing xarray
xarray-extensionscientific-computingbayesian-inference

More Mathematics packages