DataArray.to_dataframe(name=None, dim_order=None)

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).

Other coordinates are included as columns in the DataFrame.

  • name – Name to give to this array (required if unnamed).

  • dim_order – 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.


DataArray as a pandas DataFrame.

Return type