当前位置:网站首页>Numpy common function table sorting of data processing
Numpy common function table sorting of data processing
2022-04-23 05:56:00 【ShuangTwo】
function | Concrete realization : In the table a, b Represents an array |
---|---|
Import numpy library | import numpy as np |
Use array Create array | np.array(([1,2,3],[4,5,6])) |
Creates an array of the specified data type | np.array([[1,2,3],[4,5,6]], dtype=np.int32) |
Create an array of default data types | np.arange(5) |
from 1 To 2 Generate 5 A floating point number | np.linspace(1,2,5) |
Create whole 0 Array | np.zeros((2,3)) |
Create whole 0 Array | np.ones((2,3)) |
The main diagonal element is 1 The other elements are 0 | arr = np.eye(3) |
Generate [0,1) Between random floating-point numbers | np.random.random((2,3)) |
Generate [0,10) Random integer between | np.random.randint(0,10,(3,2)) |
Data type of array element | a.dtype |
The number of bytes of memory occupied by array elements | a.dtype.itemsize |
The number of bytes of memory occupied by array elements | a.itemsize |
Dimension of array | a.shape |
Number of array elements | a.size |
Array row variable column , Be similar to transpose() | a.T |
Row to column ( It's like matrix transposition ) | a.transpose() |
View array dimensions | a.shape |
return 3 That's ok 2 Array of columns | a.reshape(3,2) |
Returns a one-dimensional array | a.ravel() |
The last element | a[-1] |
Back to page 2 To the first 5 Elements | a[2:5] |
Back to page 0 To the first 7 Elements , In steps of 3 | a[:7:3] |
Returns an array in reverse order | a[::-1] |
Horizontal merger | np.hstack((a,b)) |
Merge vertically | np.vstack((a,b)) |
Deep merge | np.dstack((a,b)) |
Horizontal split , return list | np.hsplit(a, 3) |
Split Vertically , return list | np.vsplit(a, 3) |
Deep split , return list | np.dsplit(a, 3) |
Arrays and constants can do four operations | a+2 |
Arrays and arrays can do four operations | a/b |
Determine whether the array is equal | (a == b).all() |
Sum of all elements | a.sum() |
The product of all elements | a.prod() |
The arithmetic mean of all elements | a.mean() |
The maximum value of all elements | a.max() |
The minimum of all elements | a.min() |
Less than 3 The element of is replaced by 3, Greater than 4 The element of is replaced by 4 | a.clip(3,4) |
Return is greater than the 2 Array of elements of | a.compress(a>2) |
return python Of list | a.tolist() |
Calculate variance ( The mean of the square of the difference between the element and the mean ) | a.var() |
Calculate the standard deviation ( The arithmetic square root of variance ) | a.std() |
Returns the difference between the maximum and minimum values of an array | a.ptp() |
Returns the index of the minimum value in a flat array | a.argmin() |
Returns the index of the maximum value in a flat array | a.argmax() |
Return all values as 2 The index of the element | np.where(a == 2) |
Returns the difference between adjacent elements | np.diff(a) |
Returns a logarithmic array | np.log(a) |
Returns an array of exponents | np.exp(a) |
Return the square root array | np.sqrt(a |
Array sorting | np.msort(a |
Returns the maximum value array of corresponding position elements in multiple arrays | np.maximum(a, b) |
Returns the minimum value array of corresponding position elements in multiple arrays | np.minimum(a, b) |
Real mathematical division of integers | np.true_divide(a, b) |
版权声明
本文为[ShuangTwo]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230541368408.html
边栏推荐
- Conda 虚拟环境管理(创建、删除、克隆、重命名、导出和导入)
- PreparedStatement防止SQL注入
- Software architecture design - software architecture style
- Latex quick start
- Treatment of tensorflow sequelae - simple example record torch utils. data. dataset. Picture dimension problem when rewriting dataset
- Meta annotation (annotation of annotation)
- PyEMD安装及简单使用
- rsync实现文件服务器备份
- 事实最终变量与最终变量
- Pyqt5 learning (I): Layout Management + signal and slot association + menu bar and toolbar + packaging resource package
猜你喜欢
数字图像处理基础(冈萨雷斯)一
Navicate连接oracle(11g)时ORA:28547 Connection to server failed probable Oeacle Net admin error
JDBC连接数据库
Latex quick start
You cannot access this shared folder because your organization's security policy prevents unauthenticated guests from accessing it
Multithreading and high concurrency (1) -- basic knowledge of threads (implementation, common methods, state)
MySQL realizes master-slave replication / master-slave synchronization
Pytorch learning record (III): structure of neural network + using sequential and module to define the model
建表到页面完整实例演示—联表查询
Pytorch学习记录(三):神经网络的结构+使用Sequential、Module定义模型
随机推荐
事实最终变量与最终变量
MySQL事务
Get the value of state in effects in DVA
The attendance client date of K / 3 wise system can only be selected to 2019
Pytorch——数据加载和处理
lambda表达式
LDCT图像重建论文——Eformer: Edge Enhancement based Transformer for Medical Image Denoising
容器
解决报错:ImportError: IProgress not found. Please update jupyter and ipywidgets
Meta annotation (annotation of annotation)
Configure domestic image accelerator for yarn
PyQy5学习(二):QMainWindow+QWidget+QLabel
The official website of UMI yarn create @ umijs / UMI app reports an error: the syntax of file name, directory name or volume label is incorrect
实操—Nacos安装与配置
Graphic numpy array matrix
Ora: 28547 connection to server failed probable Oracle net admin error
The user name and password of users in the domain accessing the samba server outside the domain are wrong
sklearn之 Gaussian Processes
字符串(String)笔记
protected( 被 protected 修饰的成员对于本包和其子类可见)