Convert this dataset into a pandas.DataFrame. Non-index variables in this dataset form the columns of the DataFrame. The DataFrame is indexed by the Cartesian product of this dataset's indices. Parameters ---------- dim_order: Sequence of Hashable or
(self, dim_order: Sequence[Hashable] | None = None)
| 7298 | return broadcasted_df[columns_in_order] |
| 7299 | |
| 7300 | def to_dataframe(self, dim_order: Sequence[Hashable] | None = None) -> pd.DataFrame: |
| 7301 | """Convert this dataset into a pandas.DataFrame. |
| 7302 | |
| 7303 | Non-index variables in this dataset form the columns of the |
| 7304 | DataFrame. The DataFrame is indexed by the Cartesian product of |
| 7305 | this dataset's indices. |
| 7306 | |
| 7307 | Parameters |
| 7308 | ---------- |
| 7309 | dim_order: Sequence of Hashable or None, optional |
| 7310 | Hierarchical dimension order for the resulting dataframe. All |
| 7311 | arrays are transposed to this order and then written out as flat |
| 7312 | vectors in contiguous order, so the last dimension in this list |
| 7313 | will be contiguous in the resulting DataFrame. This has a major |
| 7314 | influence on which operations are efficient on the resulting |
| 7315 | dataframe. |
| 7316 | |
| 7317 | If provided, must include all dimensions of this dataset. By |
| 7318 | default, dimensions are in the same order as in `Dataset.sizes`. |
| 7319 | |
| 7320 | Returns |
| 7321 | ------- |
| 7322 | result : DataFrame |
| 7323 | Dataset as a pandas DataFrame. |
| 7324 | |
| 7325 | """ |
| 7326 | |
| 7327 | ordered_dims = self._normalize_dim_order(dim_order=dim_order) |
| 7328 | |
| 7329 | return self._to_dataframe(ordered_dims=ordered_dims) |
| 7330 | |
| 7331 | def _set_sparse_data_from_dataframe( |
| 7332 | self, idx: pd.Index, arrays: list[tuple[Hashable, np.ndarray]], dims: tuple |