Issue 1:
When using numpy.random.choice to select one object from a list of large integers it sometimes transform the integer into a float losing the exact value of the integer.

Reproducing code example:

a =[2719731347783780899, 12101784904839573027]
result = np.random.choice(a, 1)[0]
print(type(result), result, int(result))

This does not match the behaviour when using larger or smaller values, for example:

b = [98639646499002920190162389576535446980143321954085953494713932, 50562095890851553294979528226801422915940222716450081597866592]
c = [12341324134, 52341341312]
result2 = np.random.choice(b, 1)[0]
print(type(result2), result2)
result3 = np.random.choice(b, 1)[0]
print(type(result3), result3)

Probable Cause of this behaviour:

When calling np.random.choice() on a list numpy first converts it into a numpy.array and it decides a different dtype for different sizes of integers, with the same examples as above, the

a =[2719731347783780899, 12101784904839573027]
b = [98639646499002920190162389576535446980143321954085953494713932, 50562095890851553294979528226801422915940222716450081597866592]
c = [12341324134, 52341341312]
print(np.array(a).dtype, np.array(b).dtype, np.array(c).dtype)

The results are dtype('float64'), dtype('O') and dtype('int64'). I understand that there is a limit of size on dtype('int64') but I would not expect numpy to transform integers into floats because it does not maintain the initial value, I would expect it to transform it into a python object.

Issue 2:
Python 3.7.2 (default, Jun 25 2019, 20:08:50)

[GCC 6.3.0 20170516] on linux

Type "help", "copyright", "credits" or "license()" for more information.

import numpy

Traceback (most recent call last):

File "/usr/local/lib/python3.7/site-packages/numpy/core/init.py", line 17, in

from . import multiarray

File "/usr/local/lib/python3.7/site-packages/numpy/core/multiarray.py", line 14, in

from . import overrides

File "/usr/local/lib/python3.7/site-packages/numpy/core/overrides.py", line 7, in

from numpy.core._multiarray_umath import (

ImportError: /lib/arm-linux-gnueabihf/libm.so.6: version `GLIBC_2.27' not found (required by /usr/local/lib/python3.7/site-packages/numpy/core/_multiarray_umath.cpython-37m-arm-linux-gnueabihf.so)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "<pyshell#0>", line 1, in

import numpy

File "/usr/local/lib/python3.7/site-packages/numpy/init.py", line 142, in

from . import core

File "/usr/local/lib/python3.7/site-packages/numpy/core/init.py", line 47, in

raise ImportError(msg)

ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy c-extensions failed.

Try uninstalling and reinstalling numpy.

If you have already done that, then:

Check that you expected to use Python3.7 from "/usr/local/bin/python3.7",

and that you have no directories in your PATH or PYTHONPATH that can

interfere with the Python and numpy version "1.17.2" you're trying to use.

If (1) looks fine, you can open a new issue at

https://github.com/numpy/numpy/issues. Please include details on:

how you installed Python

how you installed numpy

your operating system

whether or not you have multiple versions of Python installed

if you built from source, your compiler versions and ideally a build log

If you're working with a numpy git repository, try git clean -xdf

(removes all files not under version control) and rebuild numpy.

Note: this error has many possible causes, so please don't comment on

an existing issue about this - open a new one instead.

Original error was: /lib/arm-linux-gnueabihf/libm.so.6: version `GLIBC_2.27' not found (required by /usr/local/lib/python3.7/site-packages/numpy/core/_multiarray_umath.cpython-37m-arm-linux-gnueabihf.so)

================================================

Using Raspbian, I have multiple versions of python, I used

pi@raspberrypi:~ $ sudo python3.7 -m pip install numpy