bundles / numpy 2.4.3 / numpy / _core / numerictypes / obj2sctype
function
numpy._core.numerictypes:obj2sctype
Signature
def obj2sctype ( rep , default = None ) Summary
Return the scalar dtype or NumPy equivalent of Python type of an object.
Parameters
rep: anyThe object of which the type is returned.
default: any, optionalIf 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 typeThe data type of
rep.
Examples
from numpy._core.numerictypes import obj2sctype obj2sctype(np.int32) obj2sctype(np.array([1., 2.])) obj2sctype(np.array([1.j]))
obj2sctype(dict) obj2sctype('string')
obj2sctype(1, default=list)
See also
Aliases
-
numpy._core.numerictypes.obj2sctype