Answers for "only size-1 arrays can be converted to python scalars"

0

only size-1 arrays can be converted to python scalars

# TypeError: only size-1 arrays can be converted to Python scalars
# Most often from trying to convert a NumPy array values to another format

#solution use astype:

x = np.array([1.0,2.0,3.0])

x.astype(int)
Posted by: Guest on January-23-2022

Code answers related to "only size-1 arrays can be converted to python scalars"

Browse Popular Code Answers by Language