numpy用法
来源:互联网 发布:jquery 删除二维数组 编辑:程序博客网 时间:2024/06/07 03:55
http://www.numpy.org/
numpy reference:
https://docs.scipy.org/doc/numpy/reference/
numpy quickstart tutorial:
https://docs.scipy.org/doc/numpy/user/quickstart.html
https://docs.scipy.org/doc/numpy/reference/arrays.ndarray.html
1 创建ndarray
https://docs.scipy.org/doc/numpy/reference/routines.array-creation.html#routines-array-creation
import numpy as nparr = np.array([1, 3, 5, 7])arr1 = np.array([[1, 2, 3], [4, 5, 6]])print arrprint arr * arrprint arr -arrprint 1.0 / arrprint arr ** 0.5, '\n'print arr1, '\n'print arr1.shape, '\n'
输出:
2 一些小知识点
2.1 属性
ndarray属性:
ndarray.shape #Tuple of array dimensions.
2.2 方法
numpy.nonzero(a) #return the indices of the elements that are non-zero
numpy.argsort() #returns the indices that would sort an array.import numpy as npx = np.array([3, 1, 2])print x.argsort()print x.argsort()[:-4:-1] # -1代表步长[1 2 0][0 2 1]
阅读全文
0 0
- numpy用法
- numpy用法
- numpy 用法
- numpy函数tile用法
- numpy mean()用法
- NumPy 常见用法
- numpy函数:shape用法
- Numpy reshape用法
- numpy函数:shape用法
- python numpy用法讲解
- numpy基本用法
- numpy中的where用法
- numpy中linspace用法
- numpy 矩阵的用法
- numpy库函数:reshape用法
- numpy库函数:zeros用法
- numpy.average的用法
- numpy库用法总结
- Appium 常用方法
- R聚类算法-(K-Means算法)
- Python 守护进程 实现 start stop restart
- jackson对日期的处理(序列化与反序列化)
- RocketMQ实战(一)
- numpy用法
- 修改navigationbar间距及高度
- Linux内核分析-4/5/系统调用
- touch事件中的touches、targetTouches和changedTouches(详解)
- Decoding CodeForces
- Vue.js——60分钟快速入门
- 一心沉迷于IT工作无法自拔(我骄傲)
- 参加第七届GOPS2017全球运维大会北京站会有哪些收益?
- leetcode 46. Permutations