numpy.ndarray.tolist will do it:

a.tolist()

If your data is a pandas series you can call their tolist wrapper with the same result.

Answer from bigonazzi on Stack Overflow
Discussions

python - Convert 2D float array to 2D int array in NumPy - Stack Overflow
How do I convert a float NumPy array into an int NumPy array? More on stackoverflow.com
๐ŸŒ stackoverflow.com
June 28, 2020
python - Convert Numpy array with 'n' and 'y' into integer array of 0 and 1 - Data Science Stack Exchange
Data Science is part of Stack ... the best answers rise to the top. Find your community ยท The 2026 Annual Developer Survey Results Site is liveโ€” view the results here!. ... I have a NumPy array of strings: 'n', 'y', wanna convert it into integer array of 0, 1, how to convert ... More on datascience.stackexchange.com
๐ŸŒ datascience.stackexchange.com
January 10, 2020
python - Converting numpy array values into integers - Stack Overflow
We're unable to load activity right now. Please check back shortly. 0 How can I convert a numpy array of float type into a numpy array of int type? More on stackoverflow.com
๐ŸŒ stackoverflow.com
python - convert numpy array to integer array - Stack Overflow
Explore Stack Internal ... Save this question. Show activity on this post. Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 5 years ago. ... Please clearly define what you want. Do you want a numpy array ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
October 21, 2020
๐ŸŒ
Saturn Cloud
saturncloud.io โ€บ blog โ€บ converting-numpy-array-values-into-integers-a-comprehensive-guide
Converting Numpy Array Values into Integers: A Guide | Saturn Cloud Blog
May 1, 2026 - The astype(int) function converts the floating-point numbers in the array to integers. Note that this function truncates the decimal part of the number, rather than rounding to the nearest integer.
๐ŸŒ
Statology
statology.org โ€บ home โ€บ how to convert numpy array of floats into integers
How to Convert NumPy Array of Floats into Integers
April 3, 2025 - Method 2: Convert Floats to Integers (Rounded to Nearest Integer) rounded_integer_array = (np.rint(some_floats)).astype(int) ... The following examples show how to use each method in practice with the following NumPy array of floats:
๐ŸŒ
NumPy
numpy.org โ€บ doc โ€บ 2.1 โ€บ reference โ€บ generated โ€บ numpy.ndarray.astype.html
numpy.ndarray.astype โ€” NumPy v2.1 Manual
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, order given by dtype, order. ... When casting from complex to float or int.
Find elsewhere
๐ŸŒ
Medium
medium.com โ€บ @amit25173 โ€บ different-ways-to-convert-numpy-float-to-int-f47f3be42453
Different Ways to Convert NumPy Float to Int | by Amit Yadav | Medium
April 12, 2025 - โŒ No, it wonโ€™t work. .astype(int) is a NumPy-specific method, so you need to first convert your list into a NumPy array.
๐ŸŒ
Finxter
blog.finxter.com โ€บ home โ€บ learn python blog โ€บ 5 best ways to convert numpy arrays to integers in python
5 Best Ways to Convert numpy Arrays to Integers in Python - Be on the Right Side of Change
February 20, 2024 - The np.around() function rounds each element of the numpy array to the nearest integer. After rounding, the array can be converted to integer type using astype(int).
๐ŸŒ
Seaborn Line Plots
marsja.se โ€บ home โ€บ programming โ€บ python โ€บ how to convert a float array to an integer array in python with numpy
How to Convert a Float Array to an Integer Array in Python with NumPy
August 20, 2023 - Note, if you have imported your data with Pandas you can also convert the dataframe to a NumPy array. In the next section, we will convert the 1-dimensional array to integer data type using the astype() method.
๐ŸŒ
Educative
educative.io โ€บ answers โ€บ how-to-convert-data-types-of-arrays-using-numpy-in-python
How to convert data types of arrays using NumPy in Python
Line 7: We use the astype() method to change the my_array array from a float type to an integer type and assign the value to a new variable called new_array. Line 9: We print the new variable, new_array.
๐ŸŒ
Moonbooks
moonbooks.org โ€บ Articles โ€บ How-to-convert-a-float-array-to-an-integer-array-in-python-
How to convert a float array to an integer array in python ?
August 24, 2022 - >>> import numpy as np >>> A = np.array((0.4, 1.6, 2.1, -3.7, 2.9)) >>> A array([ 0.4, 1.6, 2.1, -3.7, 2.9]) >>> A = np.rint(A) >>> A array([ 0., 2., 2., -4., 3.]) >>> A = A.astype(int) >>> A array([ 0, 2, 2, -4, 3])
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 49157647 โ€บ converting-numpy-array-to-single-integer
python - Converting numpy array to single integer - Stack Overflow
However, as @Christian Dean points out, this question deals with an array in a tuple. So you need: ... distance_index is a tuple itself, containing the Numpy array. You need to index the tuple, then index the Numpy array.
๐ŸŒ
Reddit
reddit.com โ€บ r/learnpython โ€บ how can i convert a numpy array of bools to integers?
r/learnpython on Reddit: How can I convert a numpy array of bools to integers?
May 18, 2019 -

I have two arrays, im1 and im2. When I say im1>im2, I get an array corresponding to the piece-wise evaluation of that statement. What I want now is to convert those trues and falses into 1's and 0's. How might I go about that, other than the obvious nested for loop?

๐ŸŒ
w3resource
w3resource.com โ€บ python-exercises โ€บ numpy โ€บ python-numpy-exercise-82.php
NumPy: Convert a NumPy array of float values to a NumPy array of integer values - w3resource
August 29, 2025 - print(x.astype(int)): Convert the elements of the array x to integers using the astype method, and then print the resulting array. The astype method creates a new array with the int data type.