# xarray.IndexVariable.copy

#### IndexVariable.copy(deep=True, data=None)[[source]](https://github.com/pydata/xarray/blob/main/xarray/core/variable.py#L3237-L3280)

Returns a copy of this object.

deep is ignored since data is stored in the form of
pandas.Index, which is already immutable. Dimensions, attributes
and encodings are always copied.

Use data to create a new object with the same structure as
original but entirely new data.

* **Parameters:**
  * **deep** ([`bool`](https://docs.python.org/3/builtins/functions.html#bool), *default*: [`True`](https://docs.python.org/3/builtins/constants.html#True)) – Deep is ignored when data is given. Whether the data array is
    loaded into memory and copied onto the new object. Default is True.
  * **data** ([array_like](https://numpy.org/doc/stable/glossary.html#term-array_like), *optional*) – Data to use in the new object. Must have same shape as original.
* **Returns:**
  **object** ([`Variable`](xarray.Variable.html.md#xarray.Variable)) – New object with dimensions, attributes, encodings, and optionally
  data copied from original.
