# xarray.CFTimeIndex.to_frame

#### CFTimeIndex.to_frame(index=True, name=<no_default>)[[source]](https://github.com/pydata/xarray/blob/main/xarray/../.pixi/envs/doc/lib/python3.15/site-packages/pandas/core/indexes/base.py#L1766-L1831)

Create a DataFrame with a column containing the Index.

This method wraps the Index values into a single-column DataFrame,
optionally preserving the original Index as the new DataFrame’s index.

* **Parameters:**
  * **index** ([`bool`](https://docs.python.org/3/builtins/functions.html#bool), *default* [`True`](https://docs.python.org/3/builtins/constants.html#True)) – Set the index of the returned DataFrame as the original Index.
  * **name** (`Hashable`, `defaults` to `index.name`) – The passed name should substitute for the index name (if it has
    one).
* **Returns:**
  [`DataFrame`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html#pandas.DataFrame) – DataFrame containing the original Index data.

#### SEE ALSO
`Index.to_series`
: Convert an Index to a Series.

`Series.to_frame`
: Convert Series to DataFrame.

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('cadd1155-d178-4588-bcbc-e83d795ad097','e0fb6a7a-83e6-4925-97eb-48668e1d4a0b','bf0dcea1-afe9-45b9-887e-1a3771cd2fcb','../lite/tree/../notebooks/index.html?path=accf4a33_371c_4e5e_8250_9c82d3230bef.ipynb','None')">Try it in your browser!</button></div>
```pycon
>>> idx = pd.Index(["Ant", "Bear", "Cow"], name="animal")
>>> idx.to_frame()
       animal
animal
Ant       Ant
Bear     Bear
Cow       Cow
```

By default, the original Index is reused. To enforce a new Index:

```pycon
>>> idx.to_frame(index=False)
    animal
0   Ant
1  Bear
2   Cow
```

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

```pycon
>>> idx.to_frame(index=False, name="zoo")
    zoo
0   Ant
1  Bear
2   Cow
```

<div id="bf0dcea1-afe9-45b9-887e-1a3771cd2fcb" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('cadd1155-d178-4588-bcbc-e83d795ad097','bf0dcea1-afe9-45b9-887e-1a3771cd2fcb')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('cadd1155-d178-4588-bcbc-e83d795ad097','bf0dcea1-afe9-45b9-887e-1a3771cd2fcb')">Open In Tab</button></div><div id="e0fb6a7a-83e6-4925-97eb-48668e1d4a0b" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
