# xarray
> # xarray: N-D labeled arrays and datasets
>
> [](https://xarray.dev)
> [](https://pixi.sh)
> [](https://github.com/pydata/xarray/actions/workflows/ci.yaml?query=branch%3Amain)
> [](https://codecov.io/gh/pydata/xarray)
> [](https://docs.xarray.dev/)
> [](https://asv-runner.github.io/asv-collection/xarray/)
> [](https://github.com/astral-sh/ruff)
> [](https://mypy-lang.org/)
> [](https://pypi.python.org/pypi/xarray/)
> [](https://pypistats.org/packages/xarray)
> [](https://anaconda.org/anaconda/xarray)
> [](https://doi.org/10.5281/zenodo.598201)
> [](https://mybinder.org/v2/gh/pydata/xarray/main?urlpath=lab/tree/doc/examples/weather-data.ipynb)
> [](https://x.com/xarray_dev)
>
> **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](https://www.numpy.org)-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](https://pandas.pydata.org), the popular data analysis package
> focused on labelled tabular data. It is particularly tailored to working
> with [netCDF](https://www.unidata.ucar.edu/software/netcdf) files, which
> were the source of xarray\'s data model, and integrates tightly with
> [dask](https://dask.org) 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](https://www.numpy.org) 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
> .
>
> Try out an [interactive Jupyter
> notebook](https://mybinder.org/v2/gh/pydata/xarray/main?urlpath=lab/tree/doc/examples/weather-data.ipynb).
>
> ## Contributing
>
> You can find information about contributing to xarray at our
> [Contributing
> page](https://docs.xarray.dev/en/stable/contributing.html).
>
> ## Get in touch
>
> - Ask usage questions ("How do I?") on
> [GitHub Discussions](https://github.com/pydata/xarray/discussions).
> - Report bugs, suggest features or view the source code [on
> GitHub](https://github.com/pydata/xarray).
> - For less well defined questions or ideas, or to announce other
> projects of interest to xarray users, use the [mailing
> list](https://groups.google.com/forum/#!forum/xarray).
>
> ## NumFOCUS
>
>
>
> Xarray is a fiscally sponsored project of
> [NumFOCUS](https://numfocus.org), 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](https://numfocus.org/donate-to-xarray) to support
> our efforts.
>
> ## History
>
> Xarray is an evolution of an internal tool developed at [The Climate
> Corporation](https://climate.com/). 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](https://numfocus.org) in August 2018.
>
> ## Contributors
>
> Thanks to our many contributors!
>
> [](https://github.com/pydata/xarray/graphs/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
>
>
>
> 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/compat/npcompat.py`
> - Seaborn: `_determine_cmap_params` in `xarray/plot/utils.py`
>
> Xarray also bundles portions of CPython, which is available under the
> "Python Software Foundation License" in `xarray/namedarray/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.
2014-2026, xarray Developers
## Pages in this subsection
- [User Guide](index.html.md): In this user guide, you will find detailed descriptions and
- [Terminology](terminology.html.md): *Xarray terminology differs slightly from CF, mathematical conventions, and
- [Data Structures](data-structures.html.md): `xarray.DataArray` is xarray’s implementation of a labeled,
- [Hierarchical data](hierarchical-data.html.md): Many real-world datasets are composed of multiple differing components,
- [Parallel Computing with Dask](dask.html.md): ```ipython3
- [Indexing and selecting data](indexing.html.md): Xarray offers extremely flexible indexing routines that combine the best
- [Combining data](combining.html.md): - For combining datasets or data arrays along a single dimension, see concatenate.
- [Reshaping and reorganizing data](reshaping.html.md): Reshaping and reorganizing data refers to the process of changing the structure or organization of d...
- [Computation](computation.html.md): The labels associated with `DataArray` and
- [GroupBy: Group and Bin Data](groupby.html.md): Often we want to bin or group data, produce statistics (mean, variance) on
- [Interpolating data](interpolation.html.md): Xarray offers flexible interpolation routines, which have a similar interface
- [Reading and writing files](io.html.md): Xarray supports direct serialization and IO to several file formats, from
- [Complex Numbers](complex-numbers.html.md): Xarray leverages NumPy to seamlessly handle complex numbers in `DataArray` and `Dataset` objects.
- [Plotting](plotting.html.md): Labeled data enables expressive computations. These same
- [Working with pandas](pandas.html.md): One of the most important features of xarray is the ability to convert to and
- [Working with numpy-like arrays](duckarrays.html.md): NumPy-like arrays (often known as duck arrays) are drop-in replacements for the `numpy.ndarray`
- [Xarray related projects](ecosystem.html.md): Below is a list of existing open source projects that build
- [Time series data](time-series.html.md): A major use case for xarray is multi-dimensional time-series data.
- [Weather and climate data](weather-climate.html.md): Xarray can leverage metadata that follows the Climate and Forecast (CF) conventions if present. Exam...
- [Configuration](options.html.md): Xarray offers a small number of configuration options through `set_options()`. With these, you can
- [Testing your code](testing.html.md): Testing with hypothesis is a fairly advanced topic. Before reading this section it is recommended th...
## Optional
- [Top-level llms.txt](../llms.txt): Complete documentation index.