本文介绍了AttributeError:未知的属性密度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图掌握SciPy,但是即使我从官方 SciPy文档.
I am trying to get a hold of SciPy, but I am stuck with Unknown property density
error, even though I copied the whole code from official SciPy documentation.
这部分工作正常:
x = np.linspace(norm.ppf(0.01), norm.ppf(0.99), 100)
ax.plot(x, norm.pdf(x), 'r-', lw=5, alpha=0.6, label='norm pdf')
rv = norm()
ax.plot(x, rv.pdf(x), 'k-', lw=2, label='frozen pdf')
r = norm.rvs(size=1000)
但是下面的部分给了我AttributeError: Unknown property density
:
But the following part gives me the AttributeError: Unknown property density
:
ax.hist(r, density=True, histtype='stepfilled', alpha=0.2)
ax.legend(loc='best', frameon=False)
plt.show()
推荐答案
我遇到了类似的问题.我将python版本从2.7更改为3.6,问题得以解决.
I had a similar problem. I changed the python version from 2.7 to 3.6 and the problem solved.
这篇关于AttributeError:未知的属性密度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!