ndarray.astype

ndarray.astype(self, dtype, **kwargs)

Copy of the array, cast to a specified type.

Parameters:
dtype : str or dtype

Typecode or data-type to which the array is cast.

copy : bool, optional

Default True. By default, astype always returns a newly allocated ndarray on the same context. If this is set to False, and the dtype requested is the same as the ndarray’s dtype, the ndarray is returned instead of a copy.

Returns:
arr_t : ndarray

Unless copy is False and the other conditions for returning the input array are satisfied (see description for copy input parameter), arr_t is a new array of the same shape as the input array with dtype.