KNN-1 可能用到的python 知识点
2016-06-14 12:17
519 查看
1.python中的sum函数.sum(axis=1)
axis=0, 表示列。axis=1, 表示行。2.tile函数位他的功能是重复某个数组。比如tile(A,n),功能是将数组A重复n次,构成一个新的数组。
3. argsort 返回的是数组里从小到大的索引值4.items()返回的是列表对象,而iteritems()返回的是iterator对象。例如:print dic.items() #[('a', 'hello'), ('c', 'you'), ('b', 'how')]print dic.iteritems() #<dictionary-itemiterator object at 0x020E9A50>深究:iteritor是迭代器的意思,一次反悔一个数据项,知道没有为止 for i in dic.iteritems():print i
结果:('a', 'hello')
('c', 'you')
('b', 'how')
相关文章推荐
- python 基础
- urllib2抓取网页出现中文编码问题
- Python模块包中__init__.py文件功能分析
- Python学习-with用法
- Python解析xcodebuild -showsdks
- Python计算字符宽度的方法
- 利用python中的PIL进行矩阵与图像之间的转换
- python :用numpy把数据写进文件
- Python 中如何创建 mock?
- Python中文分词实现方法(安装pymmseg)
- Python 情感分析
- Python Mock是什么
- python学习笔记 协程
- Python socket编程
- python将图像转化为矩阵
- Python模拟表单提交登录广工图书馆
- Python找出list中最常出现元素的方法
- python定时关机小程序
- python py文件转换成可执行pyc文件 二进制加密
- Python中列表元素转为数字的方法分析