# 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('533e3092-a949-4300-969f-8aebc8a13623','998760d2-99ff-4000-84c1-3ee1dd77e479','b70cab2b-5d78-4832-bb0f-870ca19c3b8b','../lite/tree/../notebooks/index.html?path=143403fe_08d3_416a_a37b_11ed24fe3e51.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="b70cab2b-5d78-4832-bb0f-870ca19c3b8b" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('533e3092-a949-4300-969f-8aebc8a13623','b70cab2b-5d78-4832-bb0f-870ca19c3b8b')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('533e3092-a949-4300-969f-8aebc8a13623','b70cab2b-5d78-4832-bb0f-870ca19c3b8b')">Open In Tab</button></div><div id="998760d2-99ff-4000-84c1-3ee1dd77e479" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
