[python]numpy
来源:互联网 发布:免费制作电子相册软件 编辑:程序博客网 时间:2024/05/17 21:38
在numpy中定义了数组类型,矩阵类型以及简单的运算。
矩阵
在numpy中的矩阵(也可以说是数组)由三部分组成:
- ndarray
- data-type
- array-scalar
基本的用法和python的数组差不多:
from numpy import *;# basea = array([[1, 2, 3], [4, 5, 6]]);print a;print a.dtype;# reshapea = arange(60).reshape(3, 4, 5);print a;# indexprint a[...,3];print a[1,...,3];print a[:,:,2];print a[0,::2,::2];
其他类似的创建矩阵的方法:
- zeros:全是0的矩阵
- ones:全是1的矩阵
- empty:用随机数填充的矩阵
矩阵所包含的属性如下:
- flags
- shape
- strides
- ndim
- data
- size
- itemsize
- nbytes
- base
- dtype
- real
- imag
- flat
- ctypes:
- __array_interface__
- __array_struct__
- __array_priority__
0 0
- Python Numpy
- [python]numpy
- python numpy
- Python Numpy
- python numpy
- python ---numpy
- Python---Numpy
- Python--numpy
- Python Numpy
- python numpy
- python numpy
- Python numpy
- Python-numpy
- python-numpy
- python numpy
- python-numpy
- python numpy
- Python-NumPy
- leetcode 第27-28 题 Implement strStr() & Divide Two Integers
- struts2----拦截器
- 学Java的人都应该知道的那些事儿
- 北大全球选人,将招收百名“中国学”硕士
- 个人多线程程序设计经验总结
- [python]numpy
- 查询用户存储过程名 ,具体信息,表说明和列说明
- php引用传值详解
- 树形dp
- 驱动probe
- JAVA中如何在Jframe面板插入背景图片
- 别碰我女朋友
- dispatch_once的实现分析
- LAPP安装