# xarray.CFTimeIndex.to_series

#### CFTimeIndex.to_series(index=None, name=None)[[source]](https://github.com/pydata/xarray/blob/main/xarray/../.pixi/envs/doc/lib/python3.15/site-packages/pandas/core/indexes/base.py#L1700-L1764)

Create a Series with both index and values equal to the index keys.

Useful with map for returning an indexer based on an index.

* **Parameters:**
  * **index** ([`Index`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Index.html#pandas.Index) or [array-like](https://numpy.org/doc/stable/glossary.html#term-array_like), *optional*) – Index of resulting Series. If None, defaults to original index.
  * **name** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str), *optional*) – Name of resulting Series. If None, defaults to name of original
    index.
* **Returns:**
  [`Series`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.html#pandas.Series) – The dtype will be based on the type of the Index values.

#### SEE ALSO
`Index.to_frame`
: Convert an Index to a DataFrame.

`Series.to_frame`
: Convert Series to DataFrame.

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('ad1829a7-b296-4846-a1d0-ff267318606d','16e39fe5-f702-4c1d-ba25-28c205ba08f1','d61ac711-ee04-45b0-b750-3fe1a6fb816f','../lite/tree/../notebooks/index.html?path=765148ca_7e1b_4762_b542_4a5ec8ad4314.ipynb','None')">Try it in your browser!</button></div>
```pycon
>>> idx = pd.Index(["Ant", "Bear", "Cow"], name="animal")
```

By default, the original index and original name is reused.

```pycon
>>> idx.to_series()
animal
Ant      Ant
Bear    Bear
Cow      Cow
Name: animal, dtype: str
```

To enforce a new index, specify new labels to `index`:

```pycon
>>> idx.to_series(index=[0, 1, 2])
0     Ant
1    Bear
2     Cow
Name: animal, dtype: str
```

To override the name of the resulting column, specify `name`:

```pycon
>>> idx.to_series(name="zoo")
animal
Ant      Ant
Bear    Bear
Cow      Cow
Name: zoo, dtype: str
```

<div id="d61ac711-ee04-45b0-b750-3fe1a6fb816f" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('ad1829a7-b296-4846-a1d0-ff267318606d','d61ac711-ee04-45b0-b750-3fe1a6fb816f')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('ad1829a7-b296-4846-a1d0-ff267318606d','d61ac711-ee04-45b0-b750-3fe1a6fb816f')">Open In Tab</button></div><div id="16e39fe5-f702-4c1d-ba25-28c205ba08f1" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
