# 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('ee2e48e3-c315-48ab-b580-f18d44b15df4','cb0d4ea4-ddc2-4ee4-bcb9-1028f4b817e5','e58d63f6-eb96-4fd7-940a-ade6078153c4','../lite/tree/../notebooks/index.html?path=4c019a9c_aa3b_4487_86be_96c56cd02132.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="e58d63f6-eb96-4fd7-940a-ade6078153c4" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('ee2e48e3-c315-48ab-b580-f18d44b15df4','e58d63f6-eb96-4fd7-940a-ade6078153c4')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('ee2e48e3-c315-48ab-b580-f18d44b15df4','e58d63f6-eb96-4fd7-940a-ade6078153c4')">Open In Tab</button></div><div id="cb0d4ea4-ddc2-4ee4-bcb9-1028f4b817e5" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
