学习笔记之NumPy
NumPy — NumPy
- http://www.numpy.org/
- NumPy is the fundamental package for scientific computing with Python.
NumPy - Wikipedia
- https://en.wikipedia.org/wiki/NumPy
- NumPy (pronounced /ˈnʌmpaɪ/ (NUM-py) or sometimes /ˈnʌmpi/[1][2] (NUM-pee)) is a library for the Python programming language, adding support for large, multi-dimensional arrays and matrices, along with a large collection of high-level mathematical functions to operate on these arrays. The ancestor of NumPy, Numeric, was originally created by Jim Hugunin with contributions from several other developers. In 2005, Travis Oliphant created NumPy by incorporating features of the competing Numarray into Numeric, with extensive modifications. NumPy is open-source software and has many contributors.
NumPy - 维基百科,自由的百科全书
- https://zh.wikipedia.org/wiki/NumPy
- NumPy是Python语言的一个扩充程序库。支持高阶大量的维度数组与矩阵运算,此外也针对数组运算提供大量的数学函数库。NumPy的前身Numeric最早是由Jim Hugunin与其它协作者共同开发,2005年,Travis Oliphant在Numeric中结合了另一个同性质的程序库Numarray的特色,并加入了其它扩展而开发了NumPy。NumPy为开放源代码并且由许多协作者共同维护开发。
收藏 | Numpy详细教程 - 机器学习算法与Python学习
- https://mp.weixin.qq.com/s/MtwGkIhHvcaU-vmC89FfGA
- NumPy 是一个 Python 包。 它代表 “Numeric Python”。 它是一个由多维数组对象和用于处理数组的例程集合组成的库。
- Numeric,即 NumPy 的前身,是由 Jim Hugunin 开发的。 也开发了另一个包 Numarray ,它拥有一些额外的功能。 2005年,Travis Oliphant 通过将 Numarray 的功能集成到 Numeric 包中来创建 NumPy 包。 这个开源项目有很多贡献者。
- Numpy基础
- 创建数组
- 打印数组
- 基本运算
- 通用函数(ufunc)
- 索引,切片和迭代
- 形状操作
- 组合(stack)不同的数组
- 将一个数组分割(split)成几个小数组
- 视图(view)和浅复制
- 深复制
- 函数和方法(method)总览
- 进阶
- 广播法则(rule)
- 花哨的索引和索引技巧
- 通过数组索引
- 通过布尔数组索引
- ix_()函数
- 线性代数
- 矩阵类
- 索引:比较矩阵和二维数组
- 技巧和提示
- 向量组合(stacking)
- 直方图(histogram)
How to calculate distance between two points ?
- python - How can the euclidean distance be calculated with numpy? - Stack Overflow
- https://stackoverflow.com/questions/1401712/how-can-the-euclidean-distance-be-calculated-with-numpy
- dist = numpy.linalg.norm(a-b)
- numpy.linalg.norm — NumPy v1.9 Manual
- https://docs.scipy.org/doc/numpy-1.9.3/reference/generated/numpy.linalg.norm.html
How to calculate angle from velocity ?
- 2d - Calculating the angular direction from velocity - Game Development Stack Exchange
- https://gamedev.stackexchange.com/questions/17340/calculating-the-angular-direction-from-velocity
- angle = atan2 (vy,vx)
- Radian - Wikipedia
- https://en.wikipedia.org/wiki/Radian
- The radian (SI symbol rad) is the SI unit for measuring angles, and is the standard unit of angular measure used in many areas of mathematics. The length of an arc of a unit circle is numerically equal to the measurement in radians of the angle that it subtends; one radian is just under 57.3 degrees (expansion at A072097). The unit was formerly an SI supplementary unit, but this category was abolished in 1995 and the radian is now considered an SI derived unit.
- numpy.arctan2 — NumPy v1.15 Manual
- https://docs.scipy.org/doc/numpy/reference/generated/numpy.arctan2.html#numpy.arctan2
- Element-wise arc tangent of
x1/x2
choosing the quadrant correctly. - The quadrant (i.e., branch) is chosen so that
arctan2(x1, x2)
is the signed angle in radians between the ray ending at the origin and passing through the point (1,0), and the ray ending at the origin and passing through the point (x2, x1). (Note the role reversal: the “y-coordinate” is the first function parameter, the “x-coordinate” is the second.) By IEEE convention, this function is defined for x2 = +/-0 and for either or both of x1 and x2 = +/-inf (see Notes for specific values). - This function is not defined for complex-valued arguments; for the so-called argument of complex values, use
angle
. - angle = np.arctan2(vy, vx) * 180 / np.pi
How to use conditional statement on array ?
- (Python) How to use conditional statements on every element of array using [:] syntax? - Stack Overflow
- https://stackoverflow.com/questions/45848612/python-how-to-use-conditional-statements-on-every-element-of-array-using-s
- all(i == 0 for i in a)
- a[a > 1] = 1
- map(lambda x: 1 if x==0 else x, a)
- a = np.where(a == 0, 1, a)
- python - Function of Numpy Array with if-statement - Stack Overflow
- https://stackoverflow.com/questions/8036878/function-of-numpy-array-with-if-statement
- vfunc = vectorize(func)
- numpy.array — NumPy v1.15 Manual
- https://docs.scipy.org/doc/numpy/reference/generated/numpy.array.html?highlight=array#numpy.array
- numpy.array(object, dtype=None, copy=True, order='K', subok=False, ndmin=0)
- numpy.where — NumPy v1.15 Manual
- https://docs.scipy.org/doc/numpy/reference/generated/numpy.where.html?highlight=numpy%20where#numpy.where
- Return elements, either from x or y, depending on condition.
- If only condition is given, return condition.nonzero().
- numpy.vectorize — NumPy v1.15 Manual
- https://docs.scipy.org/doc/numpy/reference/generated/numpy.vectorize.html
- class numpy.vectorize(pyfunc, otypes=None, doc=None, excluded=None, cache=False, signature=None)
- Define a vectorized function which takes a nested sequence of objects or numpy arrays as inputs and returns an single or tuple of numpy array as output. The vectorized function evaluates pyfunc over successive tuples of the input arrays like the python map function, except it uses the broadcasting rules of numpy.
- The data type of the output of vectorized is determined by calling the function with the first element of the input. This can be avoided by specifying the otypes argument.
How to convert array into string ?
- numpy.array_str — NumPy v1.9 Manual
- http://memobio2015.u-strasbg.fr/conference/FICHIERS/Documentation/doc-numpy-html/reference/generated/numpy.array_str.html
How to compare ?
- numpy.maximum — NumPy v1.15 Manual
- https://docs.scipy.org/doc/numpy-1.15.1/reference/generated/numpy.maximum.html
- numpy.maximum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'maximum'>
- numpy.minimum — NumPy v1.15 Manual
- https://docs.scipy.org/doc/numpy-1.15.1/reference/generated/numpy.minimum.html
- numpy.minimum(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'minimum'>
- numpy.nanmax — NumPy v1.15 Manual
- https://docs.scipy.org/doc/numpy-1.15.1/reference/generated/numpy.nanmax.html
- numpy.nanmax(a, axis=None, out=None, keepdims=<no value>)
- numpy.nanmin — NumPy v1.15 Manual
- https://docs.scipy.org/doc/numpy-1.15.1/reference/generated/numpy.nanmin.html
- numpy.nanmin(a, axis=None, out=None, keepdims=<no value>)
- Constants — NumPy v1.15 Manual
- https://docs.scipy.org/doc/numpy-1.15.1/reference/constants.html?highlight=numpy%20nan#numpy.inf
- numpy.inf
- https://docs.scipy.org/doc/numpy-1.15.1/reference/constants.html?highlight=numpy%20nan#numpy.nan
- numpy.nan
- https://docs.scipy.org/doc/numpy-1.15.1/reference/constants.html?highlight=numpy%20nan#numpy.inf
学习笔记之NumPy的更多相关文章
- Python 学习笔记之 Numpy 库——文件操作
1. 读写 txt 文件 a = list(range(0, 100)) a = np.array(a) # a.dtype = np.int64 np.savetxt("filename. ...
- Python 学习笔记之 Numpy 库——数组基础
1. 初识数组 import numpy as np a = np.arange(15) a = a.reshape(3, 5) print(a.ndim, a.shape, a.dtype, a.s ...
- 吴裕雄--天生自然Numpy库学习笔记:NumPy Matplotlib
Matplotlib 是 Python 的绘图库. 它可与 NumPy 一起使用,提供了一种有效的 MatLab 开源替代方案. 它也可以和图形工具包一起使用,如 PyQt 和 wxPython. W ...
- 吴裕雄--天生自然Numpy库学习笔记:NumPy IO
Numpy 可以读写磁盘上的文本数据或二进制数据. NumPy 为 ndarray 对象引入了一个简单的文件格式:npy. npy 文件用于存储重建 ndarray 所需的数据.图形.dtype 和其 ...
- 吴裕雄--天生自然Numpy库学习笔记:NumPy 线性代数
import numpy.matlib import numpy as np a = np.array([[1,2],[3,4]]) b = np.array([[11,12],[13,14]]) p ...
- 吴裕雄--天生自然Numpy库学习笔记:NumPy 矩阵库(Matrix)
import numpy.matlib import numpy as np print (np.matlib.empty((2,2))) # 填充为随机数据 numpy.matlib.zeros() ...
- 吴裕雄--天生自然Numpy库学习笔记:NumPy 副本和视图
副本是一个数据的完整的拷贝,如果我们对副本进行修改,它不会影响到原始数据,物理内存不在同一位置. 视图是数据的一个别称或引用,通过该别称或引用亦便可访问.操作原有数据,但原有数据不会产生拷贝.如果我们 ...
- 吴裕雄--天生自然Numpy库学习笔记:NumPy 字节交换
大端模式:指数据的高字节保存在内存的低地址中,而数据的低字节保存在内存的高地址中,这样的存储模式有点儿类似于把数据当作字符串顺序处理:地址由小向大增加,而数据从高位往低位放 小端模式:指数据的高字节保 ...
- 吴裕雄--天生自然Numpy库学习笔记:NumPy 排序、条件刷选函数
numpy.sort() 函数返回输入数组的排序副本.函数格式如下: numpy.sort(a, axis, kind, order) 参数说明: a: 要排序的数组 axis: 沿着它排序数组的轴, ...
随机推荐
- Odoo9以后的社区版本和企业版功能上的区别
Odoo9以后的社区版本和企业版除了授权模式的区别外,整理功能上的区别 透过功能设置菜单整理的区别如下,主要功能模块. 未包括所有模块,毕竟模块太多了. 以下是企业版有,而社区版没有的功能.
- (11)模板语言-if判断
views.py from django.shortcuts import render,HttpResponse # Create your views here. def index(reques ...
- Python 3.5 in win10 pip install Orange3
http://www.lfd.uci.edu/%7Egohlke/pythonlibs/ 下载Orange3 以及 依赖包 注意网页上标出的Orange 的依赖,以及 https://github.c ...
- SQL相关语句
1.分类 数据定义语言(DDL),用来定义数据库.表 列 ,用到的关键字:create.alter.drop. 数据操作语言(DML),数据库进行更行的操作, insert.delete.update ...
- Linux内核Inotify机制学习笔记
一.Inotify简介: Inotify是一种文件变化通知机制,Linux内核从2.6.13开始引入.它是一个内核用于通知用户空间程序文件系统变化的机制.开源社区提出用户态需要内核提供一些机制,以便用 ...
- MySQL Replication--复制异常1
============================================== 问题描述: 1.从库环境:MySQL 5.7.19,主从都开启GTID模式 2.MySQL数据目录所有者被 ...
- C libraries in Linux
Copy from a book. There are several C libraries to choose from. The main options are as follows: gli ...
- #define vs. const vs enum
In one word, using const is better than define. enum is the best. There are lots of discussions. I p ...
- Python网络_TCP/IP简介
本章将介绍tcp网络编程,更多内容请参考:Python学习指南 Socket是网络编程的一个抽象概念,通常我们用一个Socket表示"打开了一个网络连接",而打开一个Socket需 ...
- notify和notifyAll的区别
转自:http://www.importnew.com/16453.html 如果某些线程在等待某些条件触发,那当那些条件为真时,你可以用 notify 和 notifyAll 来通知那些等待中的线程 ...