MCPcopy
hub / github.com/pydata/xarray / to_series

Method to_series

xarray/core/dataarray.py:4025–4042  ·  view source on GitHub ↗

Convert this array into a pandas.Series. The Series is indexed by the Cartesian product of index coordinates (in the form of a :py:class:`pandas.MultiIndex`). Returns ------- result : Series DataArray as a pandas Series. See Also

(self)

Source from the content-addressed store, hash-verified

4023 return df
4024
4025 def to_series(self) -> pd.Series:
4026 """Convert this array into a pandas.Series.
4027
4028 The Series is indexed by the Cartesian product of index coordinates
4029 (in the form of a :py:class:`pandas.MultiIndex`).
4030
4031 Returns
4032 -------
4033 result : Series
4034 DataArray as a pandas Series.
4035
4036 See Also
4037 --------
4038 DataArray.to_pandas
4039 DataArray.to_dataframe
4040 """
4041 index = self.coords.to_index()
4042 return pd.Series(self.values.reshape(-1), index=index, name=self.name)
4043
4044 def to_masked_array(self, copy: bool = True) -> np.ma.MaskedArray:
4045 """Convert this array into a numpy.ma.MaskedArray

Calls 1

to_indexMethod · 0.45