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
๐ŸŒ
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
December 2, 2023 - 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.
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
python - Converting numpy array values into integers - Stack Overflow
My values are currently showing as 1.00+e09 in an array (type float64). I would like them to show 1000000000 instead. Is this possible? ... I would like them to be integers. I am trying to write the values back into a csv file after some computation, and then convert the csv file to an excel file. More on stackoverflow.com
๐ŸŒ stackoverflow.com
python - Convert Numpy array with 'n' and 'y' into integer array of 0 and 1 - Data Science Stack Exchange
Bring the best of human thought and AI automation together at your work. Explore Stack Internal ... I have a NumPy array of strings: 'n', 'y', wanna convert it into integer array of 0, 1, how to convert it? More on datascience.stackexchange.com
๐ŸŒ datascience.stackexchange.com
January 10, 2020
python - convert numpy string array into int array - Stack Overflow
Your values are floats, not integers. It is not clear if you want a list of lists or a numpy array as your end result. You can easily get a list of lists like this: ... Sign up to request clarification or add additional context in comments. ... That is a pure python solution and it produces a list . With simple python operations, you can map inner list with float. That will convert ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
๐ŸŒ
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:
๐ŸŒ
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.
๐ŸŒ
Finxter
blog.finxter.com โ€บ 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.rint() function rounds elements to the nearest integer and maintains the same data type. To convert to actual integer type, astype(int) should be used again. ... import numpy as np float_array = np.array([1.5, 2.7, 3.3]) int_array = np.rint(float_array).astype(int) print(int_array)
Find elsewhere
๐ŸŒ
Delft Stack
delftstack.com โ€บ home โ€บ howto โ€บ numpy โ€บ numpy float to int
How to Convert Float Array to Int Array in NumPy | Delft Stack
March 11, 2025 - The astype(int) function converts each float in the array to its corresponding integer value. It effectively truncates the decimal part, which is important to note. In the example above, 1.2 becomes 1, 2.5 becomes 2, and so forth.
๐ŸŒ
NumPy
numpy.org โ€บ devdocs โ€บ reference โ€บ generated โ€บ numpy.ndarray.astype.html
numpy.ndarray.astype โ€” NumPy v2.5.dev0 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.
๐ŸŒ
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 - Original array elements: [[ 12. 12.51] [ 2.34 7.98] [ 25.23 36.5 ]] Convert float values to integer values: [[12 12] [ 2 7] [25 36]] ... x = np.array([[12.0, 12.51], [2.34, 7.98], [25.23, 36.50]]): This line creates a NumPy array x with the given float values.
๐ŸŒ
NumPy
numpy.org โ€บ doc โ€บ stable โ€บ reference โ€บ generated โ€บ numpy.ndarray.astype.html
numpy.ndarray.astype โ€” NumPy v2.4 Manual
June 22, 2021 - 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.
๐ŸŒ
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.
๐ŸŒ
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 - Super fast because it operates on the entire array at once. More efficient than looping through elements manually. Handles large datasets without performance bottlenecks. ๐Ÿ”ฅ What happens under the hood? NumPy uses C and Fortran-level optimizations, so it processes millions of elements in a fraction of a second. If youโ€™ve been using a for loop to convert numbers, switching to .astype(int) will feel like going from a bicycle to a sports car.
๐ŸŒ
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: ... Sign up to request clarification or add additional context in comments. ... distance_index is a tuple itself, containing the Numpy array. You need to index the tuple, then index the Numpy array.
๐ŸŒ
Finxter
blog.finxter.com โ€บ 5-best-ways-to-convert-a-numpy-array-to-integer-in-python
5 Best Ways to Convert a Numpy Array to Integer in Python โ€“ Be on the Right Side of Change
The snippet takes a NumPy array with floats and performs floor division by 1, effectively truncating the decimal and returning floats that represent integer values. Note that the values are still of float type, to convert them to integer one can use the astype() method.
๐ŸŒ
DcodeSnippet
dcodesnippet.com โ€บ home โ€บ programming โ€บ efficient ways to convert numpy array to integer
Efficient Ways To Convert Numpy Array To Integer | DcodeSnippet
May 19, 2024 - By simply calling astype() and passing โ€˜intโ€™ as the argument, you can seamlessly convert your array to integers. Simply call the astype() method on your Numpy array