What is numpy method int0?

Multi tool use
Multi tool use
The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


What is numpy method int0?



I've seen np.int0 used for converting bounding box floating point values to int in OpenCV problems.


np.int0



What exactly is np.int0?


np.int0



I've seen np.uint8, np.int32, etc. I can't seem to find np.int0 in any online documentation. What kind of int does this cast arguments to?


np.uint8


np.int32


np.int0





What didn't you understand from the on-line documentation and examples?
– Prune
Jan 19 at 22:54





@Prune: Well, there is no NumPy documentation for int0, as the questioner said.
– user2357112
Jan 19 at 22:56





@user2357112: I disagree. A simple search for "numpy int0 function" brings up plenty of identifications, even though it's a package constant or class rather than a function.
– Prune
Jan 19 at 23:01







Also, typing numpy.int0 into the Python command line identifies the item.
– Prune
Jan 19 at 23:02


numpy.int0





There are no occurrences of int0 in the current NumPy docs. Typing numpy.int0 into the command line isn't enough either; doing that, you might think it's a fixed-size type. One answerer already made that mistake.
– user2357112
Jan 19 at 23:06


int0


numpy.int0




3 Answers
3



int0 is an alias for intp; this, in turn, is


int0


intp



Integer used for indexing (same as C ssize_t; normally either int32 or int64)


int32


int64



-- Numpy docs: basic types





Thank you for the clarification! Why is this not mentioned in the documentation in Data types on Scipy.org? This would have been helpful to know.
– A. Hendry
Jan 19 at 22:59


Data types


Scipy.org





Now that question I don't have an answer for. :)
– Amadan
Jan 19 at 23:00





@A.Hendry Probably because no-one thought of it, yet. (Although numpydoc might be a better place to report the issue; or submit a pull-request).
– jpaugh
Jan 19 at 23:37







@jpaugh: numpydoc is the Sphinx extension NumPy uses for docstring preprocessing; problems in the NumPy documentation should be reported on the main NumPy issue tracker.
– user2357112
Jan 19 at 23:45





@user2357112 Thanks! That's what I get for trying to "drive-by" a community.
– jpaugh
Jan 19 at 23:50



Here is some more information:


# 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



It's a mere alias to int64, try this from either Python 2 or Python 3:


int64


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





I think this depends on system architecture and OS
– juanpa.arrivillaga
Jan 19 at 23:08






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

8HTjAtQy1Lz Z51
3KO,6xzF4NM76NcPwxwv7OjclFJ cuxyLd28CP7td,kg,MVaz PMHwo7

Popular posts from this blog

Visual Studio Code: How to configure includePath for better IntelliSense results

Spring cloud config client Could not locate PropertySource

Makefile test if variable is not empty