# 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.14/site-packages/pandas/core/indexes/base.py#L1712-L1774)

Create a DataFrame with a column containing the 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** ([`object`](https://docs.python.org/3/builtins/functions.html#object), `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('6360350e-f873-4179-b6b2-12d77e37e777','05c8b054-50b6-414c-a032-716d270d25da','3612532e-e3be-4258-82da-40ce864074e9','../lite/tree/../notebooks/index.html?path=c7956d33_dabd_43b2_a9a0_09ee32541536.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="3612532e-e3be-4258-82da-40ce864074e9" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('6360350e-f873-4179-b6b2-12d77e37e777','3612532e-e3be-4258-82da-40ce864074e9')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('6360350e-f873-4179-b6b2-12d77e37e777','3612532e-e3be-4258-82da-40ce864074e9')">Open In Tab</button></div><div id="05c8b054-50b6-414c-a032-716d270d25da" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
