--- id: xarray version: "2026.7.0" license: Apache-2.0 license_treatment: permissive maintenance: active --- # xarray — N-D labeled arrays and datasets in Python License: permissive · Maintenance: active · Downloads: 20.7M/mo ## 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 above — verify before relying. xarray adds dimension, coordinate, and attribute labels to NumPy-like arrays, enabling intuitive operations on multi-dimensional data by name rather than integer position. 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 pip install xarray uv add xarray poetry add xarray ## Installing xarray 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. 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') Requires Python 3.11 or later. 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_current - Install friction: low - Maintenance: active - Downloads: 20.7M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags labeled multidimensional arrays, netcdf data handling, dimension-aware array operations, scientific data structures, xarray dataset manipulation, labeled tensor operations, geospatial data processing, scientific-computing, data-structures, netcdf [View on SkillFed](https://skillfed.io/packages/xarray) · [View on PyPI](https://pypi.org/project/xarray/)