# xarray.DataArray.to_dataframe

#### DataArray.to_dataframe(name=None, dim_order=None)[[source]](https://github.com/pydata/xarray/blob/v2026.09.0/xarray/core/dataarray.py#L4088-L4150)

Convert this array and its coordinates into a tidy pandas.DataFrame.

The DataFrame is indexed by the Cartesian product of index coordinates
(in the form of a [`pandas.MultiIndex`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.MultiIndex.html#pandas.MultiIndex)). Other coordinates are
included as columns in the DataFrame.

For 1D and 2D DataArrays, see also [`DataArray.to_pandas()`](xarray.DataArray.to_pandas.html.md#xarray.DataArray.to_pandas) which
doesn’t rely on a MultiIndex to build the DataFrame.

* **Parameters:**
  * **name** (`Hashable` or [`None`](https://docs.python.org/3/builtins/constants.html#None), *optional*) – Name to give to this array (required if unnamed).
  * **dim_order** (`Sequence` of `Hashable` or [`None`](https://docs.python.org/3/builtins/constants.html#None), *optional*) – Hierarchical dimension order for the resulting dataframe.
    Array content is transposed to this order and then written out as flat
    vectors in contiguous order, so the last dimension in this list
    will be contiguous in the resulting DataFrame. This has a major
    influence on which operations are efficient on the resulting
    dataframe.

    If provided, must include all dimensions of this DataArray. By default,
    dimensions are sorted according to the DataArray dimensions order.
* **Returns:**
  **result** ([`DataFrame`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html#pandas.DataFrame)) – DataArray as a pandas DataFrame.

#### SEE ALSO
[`DataArray.to_pandas`](xarray.DataArray.to_pandas.html.md#xarray.DataArray.to_pandas), [`DataArray.to_series`](xarray.DataArray.to_series.html.md#xarray.DataArray.to_series)
