This is documentation for an old release of NumPy (version 1.6.0). Read this page in the documentation of the latest stable release (version > 1.17).
Copy of the array, cast to a specified type.
Parameters : | t : str or dtype
|
---|---|
Raises : | ComplexWarning : :
|
Examples
>>> x = np.array([1, 2, 2.5])
>>> x
array([ 1. , 2. , 2.5])
>>> x.astype(int)
array([1, 2, 2])