小编Pyt*_*lex的帖子

在Python中绘制直方图

我有两个列表,x和y.
x包含字母AZ和Y包含它们在文件中的频率.

我已经尝试过研究如何在直方图中绘制这些值,但是在理解如何绘制它时没有成功.

n, bins, patches = plt.hist(x, 26, normed=1, facecolor='blue', alpha=0.75)
Run Code Online (Sandbox Code Playgroud)

x是上面列表中的列表x吗?

python frequency histogram

20
推荐指数
1
解决办法
5万
查看次数

为什么在python中使用.count()时会出现AttributeError

array1=[ 0 5 6 6 6 0 6 0 6 8 0 19 24 7 0 4 9 14 12 0 22 17 1 0 19 6 17 4 7 0 17 24 0 6 9 22]

i=0
while i<23
      m= array1.count(i)
      i=i+1
Run Code Online (Sandbox Code Playgroud)

AttributeError: 'numpy.ndarray' object has no attribute 'count'

为什么在使用.count()时会出现属性错误?我需要导入一些东西吗?

python arrays count attributeerror

-1
推荐指数
1
解决办法
8992
查看次数

标签 统计

python ×2

arrays ×1

attributeerror ×1

count ×1

frequency ×1

histogram ×1