NumPy · Method
ndarray.astype
ndarray.astype converts an array to a requested data type. It normally returns a new array, and its casting rules control which conversions are allowed.
Last updated
- Since
- 2.4
Syntax
ndarray.astype(dtype, order='K', casting='unsafe', subok=True, copy=True)In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
ndarray.copyndarray.viewnumpy.astype