numpy 学习3
来源:互联网 发布:漫威电影补剧顺序 知乎 编辑:程序博客网 时间:2024/06/05 05:25
复习:
1、生成随机的正太分布N(3, 6.25)?怎么写?
>>a=2.5*np.random.randn(2,4)+3
array([[ 2.56193501, 2.35561233, 2.33461718, 7.16164167],
[ 4.31703616, 3.95864108, 0.26704414, 3.86756291]])
2、计算这组数据中的最大值
print a.max()
3、对一组数据进行快速排序
np.sort(a,kind='quicksort')
搬一组原始例子:
看的懂吗?努力去看懂4、计算平均值:去官方文档上去找。
>>a.mean()
5、计算E(x) :
>>print var(a)
学习:
以下方法掌握了多少?
举例学习:
1、numpy.geomspace
start : scalar #scale是比例的意思
The starting value of the sequence.
stop : scalar
The final value of the sequence, unless endpoint is False. In that case, num + 1 values are spaced over the interval in log-space, of which all but the last (a sequence of length num) are returned.
num : integer, optional
Number of samples to generate. Default is 50.
endpoint : boolean, optional
If true, stop is the last sample. Otherwise, it is not included. Default is True.
dtype : dtype
The type of the output array. If dtype is not given, infer the data type from the other input arguments.
2、numpy.meshgrid 网格
x1, x2,..., xn : array_like
1-D arrays representing the coordinates of a grid.
indexing : {‘xy’, ‘ij’}, optional
Cartesian (‘xy’, default) or matrix (‘ij’) indexing of output. See Notes for more details.
New in version 1.7.0.
sparse : bool, optional
If True a sparse grid is returned in order to conserve memory. Default is False.
New in version 1.7.0.
copy : bool, optional
If False, a view into the original arrays are returned in order to conserve memory. Default is True. Please note that sparse=False, copy=False will likely return non-contiguous arrays. Furthermore, more than one element of a broadcast array may refer to a single memory location. If you need to write to the arrays, make copies first.
New in version 1.7.0.
X1, X2,..., XN : ndarray
文档应该能看懂了!For vectors x1, x2,..., ‘xn’ with lengths Ni=len(xi) , return (N1, N2, N3,...Nn) shaped arrays if indexing=’ij’ or (N2, N1, N3,...Nn) shaped arrays if indexing=’xy’ with the elements of xirepeated to fill the matrix along the first dimension for x1, the second for x2 and so on.
- NumPy学习笔记 (3)
- numpy 学习3
- numpy 学习3
- NumPy学习笔记3-线性代数
- numpy学习笔记(3)
- Numpy学习
- NumPy学习
- numpy学习
- numpy 学习
- numpy学习
- numpy学习
- Numpy 学习
- Numpy学习
- numpy学习
- numpy 学习
- Numpy学习
- numpy学习
- numpy 学习
- android_系统广播大全
- 构造函数重载
- HYSBZ/BZOJ2301 problem b
- hadhoop入门
- 初入C++(二)类和对象,构造函数,析构函数
- numpy 学习3
- Android6.0 读写SD卡权限动态申请
- Tomcat 启动始终为preparing launch delegate状态问题解决(Dubbo相关)
- MD5校验工具开发
- FM Bandwidth IQ Rate Sample Rate
- PAT A1033. To Fill or Not to Fill (25)
- php导出EXCEL表格
- 总结
- HDU 1963 Investment