I am running into an error of "NameError" with the following code (from https://stackoverflow.com/a/14659965/3284469):
>>> import scipy
>>> import numpy
>>> values = [10, 20, 30]
>>> probabilities = [0.2, 0.5, 0.3]
>>> distrib = rv_discrete(values=(values, probabilities))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'rv_discrete' is not defined
Could you give me some solution or hint to solve the problem? Thanks!
Updated: Following the solution by mhlester, I solved the Name error, but bump into type error:
>>> from scipy.stats import rv_discrete
>>> distrib = scipy.stats.rv_discrete(values=(values, probabilities))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/scipy/stats/distributions.py", line 4903, in __init__
if name[0] in ['aeiouAEIOU']:
TypeError: 'NoneType' object has no attribute '__getitem__'