Please note, this is a STATIC archive of website www.w3resource.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
w3resource

NumPy: asscalar() function

numpy.asscalar() function

The asscalar() function is used to convert an array of size 1 to its scalar equivalent.

Syntax:

numpy.asscalar(a)
NumPy manipulation: asscalar() function

Version: 1.15.0

Parameter:

Name Description Required /
Optional
a Input array of size 1. Required

Return value:

out : scalar - Scalar representation of a. The output data type is the same type returned by the input’s item method.

Example: numpy.asscalar using a parameter

>>> import numpy as np
>>> np.asscalar(np.array([48]))
48

Pictorial Presentation:

NumPy manipulation: asscalar() function

Python - NumPy Code Editor:

Previous: asarray_chkfinite()
Next: require()