I followed “python for data analysis” in ipython trying to plot kde using pandas (Chapter 8, Bar Charts and Densities). The codes are simple:
import numpy as np import pandas as pd ser = pd.Series(np.random.randn(1000)) ser.plot(kind='kde')
error
UnboundLocalError:local variable 'klass' referenced before assignment
I googled around and I think this is a problem of local and global variables and may be due to the wrong way of importing modules. Can anyone suggest any ideas?
source share