# xarray.ufuncs.iscomplex

### xarray.ufuncs.iscomplex *= <xarray.ufuncs._unary_ufunc object>*

xarray specific variant of [`numpy.iscomplex()`](https://numpy.org/doc/stable/reference/generated/numpy.iscomplex.html#numpy.iscomplex). Handles xarray objects by dispatching to the appropriate function for the underlying array type.

Documentation from numpy:

Returns a bool array, where True if input element is complex.

What is tested is whether the input has a non-zero imaginary part, not if
the input type is complex.

* **Parameters:**
  **x** ([array_like](https://numpy.org/doc/stable/glossary.html#term-array_like)) – Input array.
* **Returns:**
  **out** ([`ndarray`](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray) of `bools`) – Output array.

#### SEE ALSO
[`isreal`](xarray.ufuncs.isreal.html.md#xarray.ufuncs.isreal)

`iscomplexobj`
: Return True if x is a complex type or an array of complex numbers.

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('b8bfb81c-8d93-4e38-b977-e1d8e81c16e7','675a3145-795e-48cb-ac62-5460953b4f6a','40fa6e62-c288-46aa-9831-4c40e203cce7','../lite/tree/../notebooks/index.html?path=1350b4e8_7d9a_4714_90f9_f518a10eb872.ipynb','None')">Try it in your browser!</button></div>
```pycon
>>> import numpy as np
>>> np.iscomplex([1+1j, 1+0j, 4.5, 3, 2, 2j])
array([ True, False, False, False, False,  True])
```

<div id="40fa6e62-c288-46aa-9831-4c40e203cce7" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('b8bfb81c-8d93-4e38-b977-e1d8e81c16e7','40fa6e62-c288-46aa-9831-4c40e203cce7')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('b8bfb81c-8d93-4e38-b977-e1d8e81c16e7','40fa6e62-c288-46aa-9831-4c40e203cce7')">Open In Tab</button></div><div id="675a3145-795e-48cb-ac62-5460953b4f6a" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
