xarray.DataArray.to_series#

DataArray.to_series()[source]#

Convert this array into a pandas.Series.

The Series is indexed by the Cartesian product of index coordinates (in the form of a pandas.MultiIndex).

If the underlying data is a sparse.COO array, the result instead only contains that array’s stored (non-fill-value) entries, indexed by their coordinates - the full Cartesian product is never materialized, which avoids a .todense() call that could raise MemoryError for large, genuinely sparse data.

Returns:

result (Series) – DataArray as a pandas Series.