Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AttributeError: module 'numpy' has no attribute 'long'

I am trying to find 9 raise to power 19 using numpy.

I am using numpy 1.24.3

This is the code I am trying:

import numpy as np
np.long(9**19)

This is the error I am getting:

AttributeError: module 'numpy' has no attribute 'long'
like image 995
Talha Tayyab Avatar asked Jun 09 '26 22:06

Talha Tayyab


1 Answers

Sadly, numpy.long was deprecated in numpy 1.20 and it is removed in numpy 1.24

If you wan the result you have to try numpy.longlong

import numpy as np
np.longlong(9**19)

#output
1350851717672992089

https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

like image 52
Talha Tayyab Avatar answered Jun 11 '26 10:06

Talha Tayyab