numpy 1.22.4 Pypi GitHub Homepage
Other Docs
ParametersReturnsBackRef
obj2sctype(rep, default=None)

Parameters

rep : any

The object of which the type is returned.

default : any, optional

If given, this is returned for objects whose types can not be determined. If not given, None is returned for those objects.

Returns

dtype : dtype or Python type

The data type of :None:None:`rep`.

Return the scalar dtype or NumPy equivalent of Python type of an object.

See Also

issctype
issubdtype
issubsctype
maximum_sctype
sctype2char

Examples

>>> 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'>
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

numpy.sctype2char numpy.issctype numpy.maximum_sctype numpy.issubsctype

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /numpy/core/numerictypes.py#228
type: <class 'function'>
Commit: