is_complex¶
- is_complex(x: Any, xp: ModuleType) bool[source][source]¶
Check if an array has a complex floating-point data type.
- Parameters:
x (
Array) – The array to check.xp (
module) – The array API namespace to use.
- Returns:
- True if the array has a complex floating-point data type,
False otherwise.
- Return type:
Examples
>>> import numpy as np >>> x = np.array([1+2j, 3+4j]) >>> is_complex(x, np) True >>> y = np.array([1, 2, 3]) >>> is_complex(y, np) False