numpy.obj2sctype(rep, default=None)
[source]
Return the scalar dtype or NumPy equivalent of Python type of an object.
Parameters: |
|
---|---|
Returns: |
|
See also
sctype2char
, issctype
, issubsctype
, issubdtype
, maximum_sctype
>>> np.obj2sctype(np.int32) <class 'numpy.int32'> >>> np.obj2sctype(np.array([1., 2.])) <class 'numpy.float64'> >>> np.obj2sctype(np.array([1.j])) <class 'numpy.complex128'>
>>> np.obj2sctype(dict) <class 'numpy.object_'> >>> np.obj2sctype('string')
>>> np.obj2sctype(1, default=list) <class 'list'>
© 2005–2019 NumPy Developers
Licensed under the 3-clause BSD License.
https://docs.scipy.org/doc/numpy-1.17.0/reference/generated/numpy.obj2sctype.html