# xarray.DataArray.to_dask_dataframe

#### DataArray.to_dask_dataframe(dim_order=None, set_index=False)[[source]](https://github.com/pydata/xarray/blob/main/xarray/core/dataarray.py#L7868-L7931)

Convert this array into a dask.dataframe.DataFrame.

* **Parameters:**
  * **dim_order** (`Sequence` of `Hashable` or 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 dask dataframe.
  * **set_index** ([`bool`](https://docs.python.org/3/builtins/functions.html#bool), *default*: [`False`](https://docs.python.org/3/builtins/constants.html#False)) – If set_index=True, the dask DataFrame is indexed by this dataset’s
    coordinate. Since dask DataFrames do not support multi-indexes,
    set_index only works if the dataset only contains one dimension.
* **Returns:**
  [`dask.dataframe.DataFrame`](https://docs.dask.org/en/latest/generated/dask.dataframe.DataFrame.html#dask.dataframe.DataFrame)

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('11233187-3343-423c-8dfe-b1f358855c46','1bf2f7a0-e802-4676-9bb3-36959888b74f','43e519dc-9f60-4384-ae24-f2476d8c06d3','../lite/tree/../notebooks/index.html?path=4eea5d2f_62ed_493a_9799_47cc4c39b2ce.ipynb','None')">Try it in your browser!</button></div>
```pycon
>>> da = xr.DataArray(
...     np.arange(4 * 2 * 2).reshape(4, 2, 2),
...     dims=("time", "lat", "lon"),
...     coords={
...         "time": np.arange(4),
...         "lat": [-30, -20],
...         "lon": [120, 130],
...     },
...     name="eg_dataarray",
...     attrs={"units": "Celsius", "description": "Random temperature data"},
... )
>>> da.to_dask_dataframe(["lat", "lon", "time"]).compute()
    lat  lon  time  eg_dataarray
0   -30  120     0             0
1   -30  120     1             4
2   -30  120     2             8
3   -30  120     3            12
4   -30  130     0             1
5   -30  130     1             5
6   -30  130     2             9
7   -30  130     3            13
8   -20  120     0             2
9   -20  120     1             6
10  -20  120     2            10
11  -20  120     3            14
12  -20  130     0             3
13  -20  130     1             7
14  -20  130     2            11
15  -20  130     3            15
```

<div id="43e519dc-9f60-4384-ae24-f2476d8c06d3" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('11233187-3343-423c-8dfe-b1f358855c46','43e519dc-9f60-4384-ae24-f2476d8c06d3')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('11233187-3343-423c-8dfe-b1f358855c46','43e519dc-9f60-4384-ae24-f2476d8c06d3')">Open In Tab</button></div><div id="1bf2f7a0-e802-4676-9bb3-36959888b74f" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
