get函数在字典内的用法,当字典内不存在a时,使用classCount.get(votelabel,0)在字典内添加了‘a’,在字典内存在‘a’之后,使用

classCount[votelabel]=classCount.get(votelabel,0)+1使得‘a’的数目增加

python内tile、shape、get函数的用法

#tile的作用
#>>> numpy.tile([0,0],(2,1))#在列方向上重复[0,0]1次,行2次
#array([[0, 0],
#     [0, 0]])

shape函数的作用

dataSetSize= dataSet.shape[0]%使用shape[0]  #读取矩阵第一维度(列)的长度

相关文章:

  • 2022-12-23
  • 2021-12-05
  • 2022-12-23
  • 2021-06-19
  • 2022-01-21
  • 2021-11-23
  • 2021-05-14
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-05
  • 2021-05-31
  • 2021-10-24
  • 2022-12-23
  • 2021-11-28
相关资源
相似解决方案