from numpy.ndarray display ouput like simple integer in python

You can use the item() method on a NumPy array to retrieve a single item as a standard Python scalar (such as an integer). Here's an example:

main.py
import numpy as np

# Creating a NumPy array
arr = np.array([5])

# Getting the value as a simple integer
output = arr.item()

print(output)  # Output will be 5
161 chars
10 lines

This will allow you to obtain a single item from a NumPy array as a simple integer.

gistlibby LogSnag