# 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('c08c59be-e38f-438f-8d9b-c76347f58cf8','4aecb107-cf8d-4043-b093-8bdefb5404f7','b6edb4b7-8b96-44ea-bc5e-9d59fa2c6093','../lite/tree/../notebooks/index.html?path=6ae3602f_ece8_461c_96fc_01b1f3770f9e.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="b6edb4b7-8b96-44ea-bc5e-9d59fa2c6093" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('c08c59be-e38f-438f-8d9b-c76347f58cf8','b6edb4b7-8b96-44ea-bc5e-9d59fa2c6093')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('c08c59be-e38f-438f-8d9b-c76347f58cf8','b6edb4b7-8b96-44ea-bc5e-9d59fa2c6093')">Open In Tab</button></div><div id="4aecb107-cf8d-4043-b093-8bdefb5404f7" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
