xarray
N-D labeled arrays and datasets in Python
Decision gist · record as of 2026-08-14
Yes. xarray is a mature, actively maintained library with no known vulnerabilities, permissive Apache-2.0 licensing, and low install friction. It solves a real problem—making multi-dimensional array operations less error-prone—and is widely used in scientific computing. Install it if you work with labeled multi-dimensional data, netCDF files, or climate and geospatial datasets.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.11 or later.
- Low install friction with a pure-Python wheel distribution.
- Active maintenance with a recent release and ongoing commits.
License · maintenance · safety
Apache-2.0 (permissive) — Apache-2.0 permissive license allows commercial and private use with minimal restrictions. Bundles code from pandas, NumPy, Seaborn (BSD), CPython (PSF), and icomoon icons (CC BY 4.0)—all compatible with permissive use.
last release 2026-07-09 (36 days) · last repo commit 2026-08-14 · 4,189 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 20,745,538 downloads/mo, #1,027 on PyPI
Alternatives
Verify before relying
import xarray as xr
import numpy as np
# Create a labeled DataArray with dimensions and coordinates
data = xr.DataArray(
np.random.rand(3, 4),
dims=['x', 'y'],
coords={'x': ['a', 'b', 'c'], 'y': ['w', 'x', 'y', 'z']}
)
# Select by label
result = data.sel(x='b')
# Sum over a named dimension
sum_x = data.sum('x')- Whether dask integration for parallel computing is included by default or requires a separate optional dependency.
- Performance characteristics for very large datasets relative to raw NumPy.
- Specific netCDF file format versions and I/O backends supported.
What it is and what it does
xarray is a Python library that layers dimension names, coordinates, and metadata on top of NumPy arrays to make working with multi-dimensional scientific data more intuitive and less error-prone. Instead of tracking array shapes and indices manually, you name dimensions and select data by label—similar to how pandas works for tabular data but extended to arbitrary numbers of dimensions. It was originally developed at The Climate Corporation for climate and geospatial work and is now a NumFOCUS fiscally sponsored project.
The library is particularly well-suited for netCDF files and integrates with pandas and NumPy. Core operations include selecting data by coordinate labels, performing reductions over named dimensions, aligning datasets with automatic handling of missing values, and groupby-style split-apply-combine workflows. It ships with a large set of domain-agnostic analytics and visualization functions. The package depends only on numpy, packaging, and pandas—all production-grade libraries—and installs as a pure Python wheel with low friction.
Use it for
- Load and manipulate netCDF climate or weather datasets with time and spatial dimensions labeled by date and location.
- Perform time-series analysis by selecting and aggregating data over named time dimensions without manual index arithmetic.
- Align and combine multiple multi-dimensional datasets on shared coordinate labels, handling missing values automatically.
- Build scientific data pipelines where dimension names make operations self-documenting and reduce indexing bugs.
- Integrate with pandas for tabular analysis and with external tools for parallel computation on large gridded datasets.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
xarray is a mature, actively maintained library with no known vulnerabilities, permissive Apache-2.0 licensing, and low install friction. It solves a real problem—making multi-dimensional array operations less error-prone—and is widely used in scientific computing. Install it if you work with labeled multi-dimensional data, netCDF files, or climate and geospatial datasets.
Install
xarray on PyPI
Before you install
Low install friction with a pure-Python wheel distribution. Active maintenance with a recent release and ongoing commits. Depends only on numpy, packaging, and pandas—all widely used, stable libraries.
Requires Python 3.11 or later.
License in practice
Apache-2.0 permissive license allows commercial and private use with minimal restrictions. Bundles code from pandas, NumPy, Seaborn (BSD), CPython (PSF), and icomoon icons (CC BY 4.0)—all compatible with permissive use.
Quickstart
import xarray as xr
import numpy as np
# Create a labeled DataArray with dimensions and coordinates
data = xr.DataArray(
np.random.rand(3, 4),
dims=['x', 'y'],
coords={'x': ['a', 'b', 'c'], 'y': ['w', 'x', 'y', 'z']}
)
# Select by label
result = data.sel(x='b')
# Sum over a named dimension
sum_x = data.sum('x')
Verify before relying
- Whether dask integration for parallel computing is included by default or requires a separate optional dependency.
- Performance characteristics for very large datasets relative to raw NumPy.
- Specific netCDF file format versions and I/O backends supported.
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.11 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 3 packagesnumpypackagingpandas |
| Maintenance | Actively maintained 36 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 20,745,538 / month, #1,027 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: Science/ResearchOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Topic :: Scientific/Engineering |
Evidence: xarray-2026.7.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “labeled multidimensional arrays”
- xarrayxarray adds dimension, coordinate, and attribute labels to NumPy-like…
- numpy-groupiesProvides optimized group-indexing operations on arrays, with…
- pint-xarrayAdds physical units support to xarray datasets and data variables…
Give your agent the search over MCP, or paste the wish link into any chat.
More Scientific/Engineering packages
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
pandas provides fast, flexible data structures (Series and DataFrame) for loading, cleaning, transforming, and analyzing labeled or relational data in Python.
scipy provides numerical algorithms for mathematics, science, and engineering—including optimization, integration, linear algebra, Fourier transforms, signal and image processing, and ODE solvers—built on numpy arrays.
scikit-learn provides a comprehensive Python library for supervised and unsupervised machine learning, including classification, regression, clustering, dimensionality reduction, and model evaluation tools built on NumPy and SciPy.
Install it if you need to train, evaluate, or deploy supervised or unsupervised learning models.
dill extends Python's pickle module to serialize and deserialize a much wider range of Python objects, including functions, lambdas, classes, and interpreter sessions, to byte streams for storage or network transmission.
Multiprocess is an enhanced fork of Python's standard multiprocessing library that uses dill for better serialization, allowing you to spawn processes with a threading-like API and share complex objects between them.
Install it if you use multiprocessing and encounter pickle serialization limits with lambdas or complex objects.
See also sparse · spatial_image · xarray-einstats · cf-xarray · linopy · odc-loader · xarray-dataclass · pint-xarray · ndcube · flox