What is the numpy int0 method?

I saw np.int0used to convert bounding box floating point values ​​to int in OpenCV tasks. What is np.int0? I saw np.uint8, np.int32etc. I can not find np.int0in any online documentation. What type of int does these arguments use?

+4
source share
3 answers

int0is an alias forintp ; this in turn amounts to

The integer used for indexing (same as C ssize_t, usually either int32or int64)

- Numpy docs: basic types

+8
source

Here is some more info:

# get complete list of datatype names
>>> np.sctypeDict.keys()

# returns the default integer type (here `int64`)
>>> np.sctypeDict['int0']
<class 'numpy.int64'>

# verify
>>> arr = np.int0([1, 2, 3])
>>> arr.nbytes
24
+1
source

This is a simple alias int64, try this from Python 2 or Python 3:

>>> import numpy
>>> numpy.int0 is numpy.int64
True
0
source

Source: https://habr.com/ru/post/1692443/


All Articles