
You are seeing negative numbers because of an overflow beyond 32 bits. Change the type of your np array to int64 using a = (np.arange(2000) ** 3).astype(np.int64) and you won’t see negative numbers. I assume you are running this code on a 32 bit machine which is why Numpy is defaulting to int32. On a 64 bit machine it defaults to int64. Hope this helps.
On Jan 28, 2019, at 11:22 PM, Yuping Wang <wyupinghhu@163.com> wrote:
Dear Nmupy developers and users: I am a new user of Numpy ,I have encountered a question about Numpy recently, which need your help. The question is below:
<捕获.JPG>
I don know why there are negative numbers can somebody explain to me why these happens Thanks in advance! _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@python.org https://mail.python.org/mailman/listinfo/numpy-discussion