Attributeerror: Module 'Numpy' Has No Attribute 'Long'

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'

1 Answer

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Maya Lin-Takahashi
Author

Maya Lin-Takahashi

Maya is a hardware enthusiast who tests and reviews smart home devices, smartphones, wearables, and audio gear. She focuses on practical consumer value and build quality.