Prerequisites
Before reading this tutorial you should know a bit of Python. If you would like to refresh your memory,take a look at the Python tutorial.
If you wish to work the examples in this tutorial, you must also have some software installed on yourcomputer. Minimally:
Python
NumPy
These you may find useful:
ipython is an enhanced interactive Python shell which is very convenient for exploring NumPy'sfeatures
matplotlib will enable you to plot graphics
SciPy provides a lot of scientific routines that work on top of NumPy
The Basics
NumPy's main object is the homogeneous multidimensional array. It is a table of elements (usually
numbers), all of the same type, indexed by a tuple of positive integers. In Numpy dimensions are calledaxes. The number of axes is rank.
For example, the coordinates of a point in 3D space [1, 2, 1] is an array of rank 1, because it has oneaxis. That axis has a length of 3. In example pictured below, the array has rank 2 (it is 2-dimensional).The first dimension (axis) has a length of 2, the second dimension has a length of 3.
[[ 1., 0., 0.],
[ 0., 1., 2.]]
Numpy's array class is called ndarray. It is also known by the alias array. Note that numpy.array isnot the same as the Standard Python Library class array.array, which only handles one-dimensionalarrays and offers less functionality. The more important attributes of an ndarray object are:
ndarray.ndim
the number of axes (dimensions) of the array. In the Python world, the number of dimensions isreferred to as rank.
ndarray.shape
the dimensions of the array. This is a tuple of integers indicating the size of the array in each
dimension. For a matrix with n rows and m columns, shape will be (n,m). The length of the
shape tuple is therefore the rank, or number of dimensions, ndim.
ndarray.size
the total number of elements of the array. This is equal to the product of the elements of shape.ndarray.dtype
an object describing the type of the elements in the array. One can create or specify dtype's using
Tentative NumPy Tutorial -_计算机软件及应用_IT/计算机_专业资料 暂无评价0人阅读0次下载举报文档 Tentative NumPy Tutorial -_计算机软件及应用_IT/计算机_...
See Also: numpy.doc.ufuncs Section “Output arguments” Examples >>> a = np.arange(10) >>> np.clip(a, 1, 8) array([1, 1, 2, 3, 4, 5,...
NumPy使用手记_计算机软件及应用_IT/计算机_专业资料。NumPy 使用手记[z] Posted...Tentative NumPy Tutori... 16页 免费 喜欢此文档的还喜欢 numpy官方参考手册 ...
Python 教程:numpy 的基本介绍 2012-04-10 12:58 作者: bukunu 来源: 本站 浏览: 1,430 views 我要评论(1 条) 字号: 大中小 摘要: 标准安装的 Python ...
4、安装 numpy numpy 和 scipy 的安装过程都要显式的指明所用 fortran 编译器的类型,而且要与前面编译 atlas 时一致(在本文中即:gfortran),这一点非常重要,...
numpy学习_计算机软件及应用_IT/计算机_专业资料。1. tile 函数 tile 函数是模板...NumPy 中的多维迭代器 暂无评价 31页 免费 Tentative NumPy Tutori... 暂无评...
安装python numpy_计算机软件及应用_IT/计算机_专业资料。安装python numpy,出现问题,如何解决。安装python numpy 研究 python-nltk 时,需要安装 numpy。 采用下面的...
Python之路numpy用法_计算机软件及应用_IT/计算机_专业资料。Python 之路——numpy 各函数简介之生成数组函数(Array creation routines) 1、empty(shape[, dtype, ...
numpy各函数简介之生成数组函数_计算机软件及应用_IT/计算机_专业资料。numpy 各函数简介之生成数组函数 1. empty(shape[, dtype, order]): 依据给定形状和类型(...
非root权限安装numpy和scipy_生物学_自然科学_专业资料。linux上可行。Install Numpy and Scipy on CentOS without Root Privilege Sometimes you want to install Nu...
热门文档