Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

np.iinfo('ulong') fails #10678

Closed
pitrou opened this issue Feb 28, 2018 · 6 comments
Closed

np.iinfo('ulong') fails #10678

pitrou opened this issue Feb 28, 2018 · 6 comments

Comments

@pitrou
Copy link
Member

pitrou commented Feb 28, 2018

>>> np.iinfo('intc')
iinfo(min=-2147483648, max=2147483647, dtype=int32)
>>> np.iinfo('uintc')
iinfo(min=0, max=4294967295, dtype=uint32)
>>> np.iinfo('longlong')
iinfo(min=-9223372036854775808, max=9223372036854775807, dtype=int64)
>>> np.iinfo('ulonglong')
iinfo(min=0, max=18446744073709551615, dtype=uint64)
>>> np.iinfo('long')
iinfo(min=-9223372036854775808, max=9223372036854775807, dtype=int64)
>>> np.iinfo('ulong')
Traceback (most recent call last):
  File "<ipython-input-20-e783aa7ef3c1>", line 1, in <module>
    np.iinfo('ulong')
  File "/home/antoine/miniconda3/envs/pyarrow/lib/python3.6/site-packages/numpy/core/getlimits.py", line 516, in __init__
    raise ValueError("Invalid integer data type.")
ValueError: Invalid integer data type.
@eric-wieser
Copy link
Member

Easy fix here is to use np.iinfo(np.uint)

I think this is because 'long' is decoded to __buitins__.long

@pitrou
Copy link
Member Author

pitrou commented Feb 28, 2018

According to https://docs.scipy.org/doc/numpy/user/basics.types.html :

Additionally to intc the platform dependent C integer types short, long, longlong and their unsigned versions are defined.

@eric-wieser
Copy link
Member

eric-wieser commented Feb 28, 2018

Docs are wrong. The C integer type long is called np.int_, and the integer type unsigned long is called np.uint

@ax3l
Copy link
Contributor

ax3l commented Sep 10, 2018

As far as I can see, this should be fixed in #11837 as well? :)

@eric-wieser
Copy link
Member

Thanks for finding this @ax3l

@ax3l
Copy link
Contributor

ax3l commented Sep 11, 2018

You are welcome, can only forward the thanks to @C0nsultant we pointed me here :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants