# xarray.zeros_like

### xarray.zeros_like(other, dtype=None, , chunks=None, chunked_array_type=None, from_array_kwargs=None)[[source]](https://github.com/pydata/xarray/blob/main/xarray/core/common.py#L1852-L1931)

Return a new object of zeros with the same shape and
type as a given dataarray or dataset.

* **Parameters:**
  * **other** ([`DataArray`](xarray.DataArray.html.md#xarray.DataArray), [`Dataset`](xarray.Dataset.html.md#xarray.Dataset) or [`Variable`](xarray.Variable.html.md#xarray.Variable)) – The reference object. The output will have the same dimensions and coordinates as this object.
  * **dtype** ([`dtype`](https://numpy.org/doc/stable/reference/generated/numpy.dtype.html#numpy.dtype), *optional*) – dtype of the new array. If omitted, it defaults to other.dtype.
  * **chunks** ([`int`](https://docs.python.org/3/builtins/functions.html#int), `"auto"`, [`tuple`](https://docs.python.org/3/builtins/stdtypes.html#tuple) of [`int`](https://docs.python.org/3/builtins/functions.html#int) or [mapping](https://docs.python.org/3/glossary.html#term-mapping) of `Hashable` to [`int`](https://docs.python.org/3/builtins/functions.html#int), *optional*) – Chunk sizes along each dimension, e.g., `5`, `"auto"`, `(5, 5)` or
    `{"x": 5, "y": 5}`.
  * **chunked_array_type** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str), *optional*) – Which chunked array type to coerce the underlying data array to.
    Defaults to ‘dask’ if installed, else whatever is registered via the ChunkManagerEnetryPoint system.
    Experimental API that should not be relied upon.
  * **from_array_kwargs** ([`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict), *optional*) – Additional keyword arguments passed on to the ChunkManagerEntrypoint.from_array method used to create
    chunked arrays, via whichever chunk manager is specified through the chunked_array_type kwarg.
    For example, with dask as the default chunked array type, this method would pass additional kwargs
    to [`dask.array.from_array()`](https://docs.dask.org/en/latest/generated/dask.array.from_array.html#dask.array.from_array). Experimental API that should not be relied upon.
* **Returns:**
  **out** ([`DataArray`](xarray.DataArray.html.md#xarray.DataArray), [`Dataset`](xarray.Dataset.html.md#xarray.Dataset) or [`Variable`](xarray.Variable.html.md#xarray.Variable)) – New object of zeros with the same shape and type as other.

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('d280a9cf-9b69-41b0-8397-37524ea7b432','e6908559-f067-451b-a63b-d45f39e62aab','ce3b76a0-d188-419e-bcd0-f67b18f824b9','../lite/tree/../notebooks/index.html?path=2e8147cb_640c_487c_8071_94592885344f.ipynb','None')">Try it in your browser!</button></div>
```pycon
>>> x = xr.DataArray(
...     np.arange(6).reshape(2, 3),
...     dims=["lat", "lon"],
...     coords={"lat": [1, 2], "lon": [0, 1, 2]},
... )
>>> x
<xarray.DataArray (lat: 2, lon: 3)> Size: 48B
array([[0, 1, 2],
       [3, 4, 5]])
Coordinates:
  * lat      (lat) int64 16B 1 2
  * lon      (lon) int64 24B 0 1 2
```

```pycon
>>> xr.zeros_like(x)
<xarray.DataArray (lat: 2, lon: 3)> Size: 48B
array([[0, 0, 0],
       [0, 0, 0]])
Coordinates:
  * lat      (lat) int64 16B 1 2
  * lon      (lon) int64 24B 0 1 2
```

```pycon
>>> xr.zeros_like(x, dtype=float)
<xarray.DataArray (lat: 2, lon: 3)> Size: 48B
array([[0., 0., 0.],
       [0., 0., 0.]])
Coordinates:
  * lat      (lat) int64 16B 1 2
  * lon      (lon) int64 24B 0 1 2
```

<div id="ce3b76a0-d188-419e-bcd0-f67b18f824b9" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('d280a9cf-9b69-41b0-8397-37524ea7b432','ce3b76a0-d188-419e-bcd0-f67b18f824b9')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('d280a9cf-9b69-41b0-8397-37524ea7b432','ce3b76a0-d188-419e-bcd0-f67b18f824b9')">Open In Tab</button></div><div id="e6908559-f067-451b-a63b-d45f39e62aab" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>

#### SEE ALSO
[`ones_like`](xarray.ones_like.html.md#xarray.ones_like), [`full_like`](xarray.full_like.html.md#xarray.full_like)
