Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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)
Source by www.statology.org #
 
PREVIOUS NEXT
Tagged: #arrays #converted #python #scalars
ADD COMMENT
Topic
Name
4+4 =