Reset the specified index(es) or multi-index level(s). This legacy method is specific to pandas (multi-)indexes and 1-dimensional "dimension" coordinates. See the more generic :py:meth:`~DataArray.drop_indexes` and :py:meth:`~DataArray.set_xindex` method to respectiv
(
self,
dims_or_levels: Hashable | Sequence[Hashable],
drop: bool = False,
)
| 2831 | return self._from_temp_dataset(ds) |
| 2832 | |
| 2833 | def reset_index( |
| 2834 | self, |
| 2835 | dims_or_levels: Hashable | Sequence[Hashable], |
| 2836 | drop: bool = False, |
| 2837 | ) -> Self: |
| 2838 | """Reset the specified index(es) or multi-index level(s). |
| 2839 | |
| 2840 | This legacy method is specific to pandas (multi-)indexes and |
| 2841 | 1-dimensional "dimension" coordinates. See the more generic |
| 2842 | :py:meth:`~DataArray.drop_indexes` and :py:meth:`~DataArray.set_xindex` |
| 2843 | method to respectively drop and set pandas or custom indexes for |
| 2844 | arbitrary coordinates. |
| 2845 | |
| 2846 | Parameters |
| 2847 | ---------- |
| 2848 | dims_or_levels : Hashable or sequence of Hashable |
| 2849 | Name(s) of the dimension(s) and/or multi-index level(s) that will |
| 2850 | be reset. |
| 2851 | drop : bool, default: False |
| 2852 | If True, remove the specified indexes and/or multi-index levels |
| 2853 | instead of extracting them as new coordinates (default: False). |
| 2854 | |
| 2855 | Returns |
| 2856 | ------- |
| 2857 | obj : DataArray |
| 2858 | Another dataarray, with this dataarray's data but replaced |
| 2859 | coordinates. |
| 2860 | |
| 2861 | See Also |
| 2862 | -------- |
| 2863 | DataArray.set_index |
| 2864 | DataArray.set_xindex |
| 2865 | DataArray.drop_indexes |
| 2866 | """ |
| 2867 | ds = self._to_temp_dataset().reset_index(dims_or_levels, drop=drop) |
| 2868 | return self._from_temp_dataset(ds) |
| 2869 | |
| 2870 | def set_xindex( |
| 2871 | self, |