🌐
NumPy
numpy.org › devdocs › reference › generated › numpy.ndarray.astype.html
numpy.ndarray.astype — NumPy v2.6.dev0 Manual
If True, then sub-classes will be passed-through (default), otherwise the returned array will be forced to be a base-class array. ... By default, astype always returns a newly allocated array.
🌐
Programiz
programiz.com › python-programming › numpy › methods › astype
NumPy astype()
The astype() method converts an array to a specified data type. The astype() method converts an array to a specified data type. Example import numpy as np # original array of integers integerArray = np.array([1, 2, 3, 4, 5]) # convert array to floating-point numbers floatArray = integerArr...
🌐
NumPy
numpy.org › doc › stable › reference › generated › numpy.ndarray.astype.html
numpy.ndarray.astype — NumPy v2.4 Manual
If True, then sub-classes will be passed-through (default), otherwise the returned array will be forced to be a base-class array. ... By default, astype always returns a newly allocated array.
🌐
NumPy
numpy.org › doc › 2.1 › reference › generated › numpy.ndarray.astype.html
numpy.ndarray.astype — NumPy v2.1 Manual
If True, then sub-classes will be passed-through (default), otherwise the returned array will be forced to be a base-class array. ... By default, astype always returns a newly allocated array.
🌐
W3Schools
w3schools.com › python › numpy › numpy_data_types.asp
NumPy Data Types
The astype() function creates a copy of the array, and allows you to specify the data type as a parameter. The data type can be specified using a string, like 'f' for float, 'i' for integer etc. or you can use the data type directly like float ...
🌐
Codecademy
codecademy.com › docs › python:numpy › ndarray › .astype()
Python:NumPy | ndarray | .astype() | Codecademy
July 18, 2024 - The .astype() function in NumPy allows changing the data type of the elements in an array.
🌐
Note.nkmk.me
note.nkmk.me › home › python › numpy
NumPy: astype() to change dtype of an array | note.nkmk.me
February 4, 2024 - NumPy arrays (ndarray) hold a data type (dtype). You can set this through various operations, such as when creating an ndarray with np.array(), or change it later with astype(). Data type objects (dty ...
Find elsewhere
🌐
NumPy
numpy.org › doc › 2.2 › reference › generated › numpy.ndarray.astype.html
numpy.ndarray.astype — NumPy v2.2 Manual
If True, then sub-classes will be passed-through (default), otherwise the returned array will be forced to be a base-class array. ... By default, astype always returns a newly allocated array.
🌐
Vultr Docs
docs.vultr.com › python › third-party › numpy › array › astype
Python Numpy array astype() - Convert Data Type | Vultr Docs
November 8, 2024 - Create a Numpy array. Use the astype() method to convert the array to another data type.
🌐
GeeksforGeeks
geeksforgeeks.org › numpy › change-numpy-array-data-type
Change the Data Type of the Given NumPy Array - GeeksforGeeks
Using the NumPy.astype() function to change the data type of the underlying data of the given NumPy array.
Published   July 11, 2025
🌐
NumPy
numpy.org › doc › 2.3 › reference › generated › numpy.ndarray.astype.html
numpy.ndarray.astype — NumPy v2.3 Manual
If True, then sub-classes will be passed-through (default), otherwise the returned array will be forced to be a base-class array. ... By default, astype always returns a newly allocated array.
🌐
NumPy
numpy.org › doc › 2.0 › reference › generated › numpy.ndarray.astype.html
numpy.ndarray.astype — NumPy v2.0 Manual
If True, then sub-classes will be passed-through (default), otherwise the returned array will be forced to be a base-class array. ... By default, astype always returns a newly allocated array.
🌐
TutorialKart
tutorialkart.com › numpy › numpy-ndarray-astype
NumPy ndarray.astype() Method:
January 29, 2025 - import numpy as np # Creating a float array arr = np.array([1.2, 2.5, 3.8]) # Safe casting to integer (prevents unsafe conversions) try: int_arr = arr.astype(int, casting='safe') print("Converted array:", int_arr) except TypeError as e: print("Error:", e)
🌐
NumPy
numpy.org › doc › 2.1 › reference › generated › numpy.astype.html
numpy.astype — NumPy v2.1 Manual
Specifies whether to copy an array when the specified dtype matches the data type of the input array x. If True, a newly allocated array must always be returned. If False and the specified dtype matches the data type of the input array, the input array must be returned; otherwise, a newly allocated ...