Hello, I bought a pythonista program and ran into a problem. When I try to import the numpy: import numpy as np library, the program throws the following error: name 'random_sample' is not defined. How to solve this problem? Thanks.
Did you try to a numpy update ? That causes problems since you cannot update numpy.
The other problem people have is that since numpy can take a while to load, if you can cancel a script, it might be only partially imported. Try force quitting the app and try again.
If that doesn't work, push the Print Traceback button, and paste the full Traceback to the forum.
I haven’t used numpy in Pythonista and I don’t have your code to work from so could be completely off the mark here, but if you do import numpy as np, wouldn’t the random_sample need to be referenced as np.random_sample?
A quick test got this to work:
import numpy as np print(np.random.random_sample())
he is getting an error during import.
This was previously discussed on the forum, and in that case it was a failed import, fixed by a force quit of pythonista