xarray 2025.4.0


pip install xarray

  Latest version

Released: Apr 29, 2025


Meta
Author: xarray Developers
Requires Python: >=3.10

Classifiers

Development Status
  • 5 - Production/Stable

License
  • OSI Approved :: Apache Software License

Operating System
  • OS Independent

Intended Audience
  • Science/Research

Programming Language
  • Python
  • Python :: 3
  • Python :: 3.10
  • Python :: 3.11
  • Python :: 3.12
  • Python :: 3.13

Topic
  • Scientific/Engineering

xarray: N-D labeled arrays and datasets

CI Code coverage Docs Benchmarked with asv Formatted with black Checked with mypy Available on pypi PyPI - Downloads Conda - Downloads DOI Examples on binder Twitter

xarray (pronounced "ex-array", formerly known as xray) is an open source project and Python package that makes working with labelled multi-dimensional arrays simple, efficient, and fun!

Xarray introduces labels in the form of dimensions, coordinates and attributes on top of raw NumPy-like arrays, which allows for a more intuitive, more concise, and less error-prone developer experience. The package includes a large and growing library of domain-agnostic functions for advanced analytics and visualization with these data structures.

Xarray was inspired by and borrows heavily from pandas, the popular data analysis package focused on labelled tabular data. It is particularly tailored to working with netCDF files, which were the source of xarray's data model, and integrates tightly with dask for parallel computing.

Why xarray?

Multi-dimensional (a.k.a. N-dimensional, ND) arrays (sometimes called "tensors") are an essential part of computational science. They are encountered in a wide range of fields, including physics, astronomy, geoscience, bioinformatics, engineering, finance, and deep learning. In Python, NumPy provides the fundamental data structure and API for working with raw ND arrays. However, real-world datasets are usually more than just raw numbers; they have labels which encode information about how the array values map to locations in space, time, etc.

Xarray doesn't just keep track of labels on arrays -- it uses them to provide a powerful and concise interface. For example:

  • Apply operations over dimensions by name: x.sum('time').
  • Select values by label instead of integer location: x.loc['2014-01-01'] or x.sel(time='2014-01-01').
  • Mathematical operations (e.g., x - y) vectorize across multiple dimensions (array broadcasting) based on dimension names, not shape.
  • Flexible split-apply-combine operations with groupby: x.groupby('time.dayofyear').mean().
  • Database like alignment based on coordinate labels that smoothly handles missing values: x, y = xr.align(x, y, join='outer').
  • Keep track of arbitrary metadata in the form of a Python dictionary: x.attrs.

Documentation

Learn more about xarray in its official documentation at https://docs.xarray.dev/.

Try out an interactive Jupyter notebook.

Contributing

You can find information about contributing to xarray at our Contributing page.

Get in touch

  • Ask usage questions ("How do I?") on GitHub Discussions.
  • Report bugs, suggest features or view the source code on GitHub.
  • For less well defined questions or ideas, or to announce other projects of interest to xarray users, use the mailing list.

NumFOCUS

Xarray is a fiscally sponsored project of NumFOCUS, a nonprofit dedicated to supporting the open source scientific computing community. If you like Xarray and want to support our mission, please consider making a donation to support our efforts.

History

Xarray is an evolution of an internal tool developed at The Climate Corporation. It was originally written by Climate Corp researchers Stephan Hoyer, Alex Kleeman and Eugene Brevdo and was released as open source in May 2014. The project was renamed from "xray" in January 2016. Xarray became a fiscally sponsored project of NumFOCUS in August 2018.

Contributors

Thanks to our many contributors!

Contributors

License

Copyright 2014-2024, xarray Developers

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Xarray bundles portions of pandas, NumPy and Seaborn, all of which are available under a "3-clause BSD" license:

  • pandas: setup.py, xarray/util/print_versions.py
  • NumPy: xarray/core/npcompat.py
  • Seaborn: _determine_cmap_params in xarray/core/plot/utils.py

Xarray also bundles portions of CPython, which is available under the "Python Software Foundation License" in xarray/core/pycompat.py.

Xarray uses icons from the icomoon package (free version), which is available under the "CC BY 4.0" license.

The full text of these licenses are included in the licenses directory.

2025.4.0 Apr 29, 2025
2025.3.1 Mar 31, 2025
2025.3.0 Mar 20, 2025
2025.1.2 Jan 31, 2025
2025.1.1 Jan 09, 2025
2025.1.0 Jan 03, 2025
2024.11.0 Nov 22, 2024
2024.10.0 Oct 24, 2024
2024.9.0 Sep 11, 2024
2024.7.0 Jul 30, 2024
2024.6.0 Jun 13, 2024
2024.5.0 May 13, 2024
2024.3.0 Mar 29, 2024
2024.2.0 Feb 19, 2024
2024.1.1 Jan 23, 2024
2024.1.0 Jan 17, 2024
2023.12.0 Dec 08, 2023
2023.11.0 Nov 17, 2023
2023.10.1 Oct 19, 2023
2023.10.0 Oct 19, 2023
2023.9.0 Sep 26, 2023
2023.8.0 Aug 20, 2023
2023.7.0 Jul 17, 2023
2023.6.0 Jun 23, 2023
2023.5.0 May 19, 2023
2023.4.2 Apr 21, 2023
2023.4.1 Apr 18, 2023
2023.4.0 Apr 14, 2023
2023.3.0 Mar 22, 2023
2023.2.0 Feb 07, 2023
2023.1.0 Jan 18, 2023
2022.12.0 Dec 02, 2022
2022.11.0 Nov 04, 2022
2022.10.0 Oct 13, 2022
2022.9.0 Sep 29, 2022
2022.6.0 Jul 22, 2022
2022.6.0rc0 Jun 09, 2022
2022.3.0 Mar 02, 2022
0.21.1 Feb 01, 2022
0.21.0 Jan 28, 2022
0.20.2 Dec 10, 2021
0.20.1 Nov 05, 2021
0.20.0 Nov 02, 2021
0.19.0 Jul 23, 2021
0.18.2 May 19, 2021
0.18.1 May 19, 2021
0.18.0 May 06, 2021
0.17.0 Feb 26, 2021
0.16.2 Nov 30, 2020
0.16.1 Sep 20, 2020
0.16.0 Jul 11, 2020
0.15.1 Mar 23, 2020
0.15.0 Jan 30, 2020
0.14.1 Nov 19, 2019
0.14.0 Oct 14, 2019
0.13.0 Sep 17, 2019
0.12.3 Jul 10, 2019
0.12.2 Jun 30, 2019
0.12.1 Apr 05, 2019
0.12.0 Mar 16, 2019
0.11.3 Jan 26, 2019
0.11.2 Jan 03, 2019
0.11.1 Dec 30, 2018
0.11.0 Nov 07, 2018
0.10.9 Sep 22, 2018
0.10.8 Jul 18, 2018
0.10.7 Jun 08, 2018
0.10.6 Jun 01, 2018
0.10.5 Jun 01, 2018
0.10.4 May 17, 2018
0.10.3 Apr 14, 2018
0.10.2 Mar 13, 2018
0.10.1 Feb 26, 2018
0.10.0 Nov 20, 2017
0.10.0rc2 Nov 14, 2017
0.10.0rc1 Oct 31, 2017
0.9.6 Jun 09, 2017
0.9.5 Apr 17, 2017
0.9.4 Apr 17, 2017
0.9.3 Apr 16, 2017
0.9.2 Apr 03, 2017
0.9.1 Jan 30, 2017
0.9.0 Jan 26, 2017
0.9.0rc1 Jan 11, 2017
0.8.2 Aug 19, 2016
0.8.1 Aug 06, 2016
0.8.0 Aug 03, 2016
0.8.0rc1 Jul 29, 2016
0.7.2 Mar 15, 2016
0.7.1 Feb 17, 2016
0.7.0 Jan 22, 2016

Wheel compatibility matrix

Platform Python 3
any

Files in release

Extras:
Dependencies:
numpy (>=1.24)
packaging (>=23.2)
pandas (>=2.1)