开发工具:
文件大小: 6mb
下载次数: 0
上传时间: 2019-08-18
详细说明:CONTENTS
1
Arrayobjects
3
1.1
TheN-dimensionalarray(ndarray)..................................
3
1.2
Scalars..................................................
73
1.3
Datatypeobjects(dtype)........................................110
1.4
Indexing.................................................121
1.5
Standardarraysubclasses........................................125
1.6
Maskedarrays..............................................250
1.7
TheArrayInterface
...........................................433
2
Universalfunctions(ufunc)
439
2.1
Broadcasting...............................................439
2.2
Outputtypedetermination........................................440
2.3
Useofinternalbuffers..........................................440
2.4
Errorhandling..............................................440
2.5
CastingRules...............................................443
2.6
ufunc..................................................445
2.7
Availableufuncs.............................................452
3
Routines
457
3.1
Arraycreationroutines..........................................457
3.2
Arraymanipulationroutines.......................................488
3.3
Indexingroutines.............................................522
3.4
Datatyperoutines............................................547
3.5
Inputandoutput.............................................559
3.6
DiscreteFourierTransform(numpy.fft)...............................579
3.7
Linearalgebra(numpy.linalg)
...................................599
3.8
Randomsampling(numpy.random)
.................................627
3.9
Sortingandsearching
..........................................678
3.10Logicfunctions..............................................691
3.11Binaryoperations.............................................707
3.12Statistics.................................................715
3.13Mathematicalfunctions
.........................................735
3.14Functionalprogramming.........................................794
CONTENTS
Array objects
1. 1 The N-dimensional array (ndarray)
1.3 Data type objects(dt ype)
“·
..110
1.4 Indexing
121
1.5 Standard array subclasses
125
1. 6 Masked arrays
250
1. 7 The Array Interface
433
2 Universal functions(ufunc)
439
2.1 Broadcasting
439
2.2 Output type determination
440
2.3 Use of internal buffers
440
2.4 Error handling
440
2.5 Casting Rules
.443
2.6 func
445
2.7 Available ufuncs
452
3 Routines
457
3.1 Array creation routines
457
3.2 Array manipulation routines
.488
3.3 Indexing routines
“
522
3.4 Data type routines
3.5 Input and output
55
3.6 Discrete Fourier Transform(numpy. fft)
579
3.7 Linear algebra (numpy linalg)
3.8 Random sampling(numpy. random
627
3.9 Sorting and searching
678
3.10 Logic functions
3.11 Binary operations
707
3. 12 Statistics
715
3. 13 Mathematical functions
735
3. 14 Functional programming
794
3.15 Polynomials
70
3.16 Financial functions
812
3.17 Set routi
820
3.18 Window functions
3. 19 Floating point error handling
.836
3.20 Masked array operations
842
3.21N
fic help functions
962
3.22 Miscellaneous routines
965
3.23 Test Support(numpy testing)
...966
3.24 Assert
967
3.25 Mathematical functions with automatic domain (numpy. emath)
977
3.26 Matrix library(numpy matlib)
977
3.27 Optionally Scipy-accelerated routines(numpy dual)
977
3.28 Numarray compatibility(numpy numarray)
......978
3.29 Old Numeric compatibility(numpy ol numeric)
978
3.30 C-Types Foreign Function Interface(numpy. ctypeslib)
978
3.31 String
operations
979
4 Packaging(numpy distutils)
1013
4.1 Modules in numpy. distutil
1013
4.2 Building Installable C libraries
1024
4.3 Conversion of, src fles
1025
5 Numpy o·API
1027
5.1 Python Types and C-Structures
..,...,1027
5.2 System configuration
1041
5.3 Data Type API
1043
5.4 Array API
1045
5.5 FUnc API
1078
5.6 Generalized Universal Function API
..1083
5.7 Numpy core libraries
1085
6 Numpy internals
l089
6. 1 Numpy c Code explanations
1089
6.2 Internal organization of numpy arrays
1096
.3 Multidimensional Array Indexing Order Issues
1097
7 Numpy and SWIG
1099
7. 1 Numpy. 1: a SWIG Interface File for NumPy
.1099
7.2 Testing the numpy. i lypemaps
1112
8 Acknowledgements
Bibliography
1117
Python Module Index
Index
1125
NumPy Reference, Release 2.0.0.dev
Release
2. 0.dev
October 30. 2010
This reference manual details functions, modules, and objects included in Numpy, describing what they are and what
hey do For learning how to use NumPy, see also user.
CONTENTS
NumPy Reference, Release 2.0.0.dev
CONTENTS
CHAPTER
ONE
ARRAY OBJECTS
NumPy provides an N-dimensional array type, the ndarray, which describes a collection of"items "of the same type.
The items can be indexed using for example n integers
All ndarrays are homogenous: every item takes up the same size block of memory, and all blocks are interpreted in
exactly the same way. How each item in the array is to be interpreted is specified by a separate data-type object, one
of which is associated with every array. In addition to basic types(integers, floats, etc. ) the data type objects can also
t data structures
An item extracted from an array, e. g by indexing, is represented by a python object whose type is one of the array
scalar types built in Numpy. The array scalars allow easy manipulation of also more complicated arrangements of
head
data-type
y
apra
scalar
header
ndarray
Figure 1.1: Figure Conceptual diagram showing the relationship between the three fundamental objects used to de
scribe the data in an array: 1)the ndarray itself, 2)the data-type object that describes the layout of a single fixed-size
element of the array, 3)the array-scalar Python object that is returned when a single element of the array is accessed
1.1 The N-dimensional array(ndarray
An ndarray is a(usually fixed-size)multidimensional container of items of the same type and size. The number
of dimensions and items in an array is defined by its shape, which is a tuple ofn positive integers that specify
the sizes of each dimension. The type of items in the array is specified by a separate data-type object (dtype), one of
hich is associated with each ndarray
As with other container objects in Python, the contents of an ndarray can be accessed and modified by indexing
or slicing the array(using, for example, N integers), and via the methods and attributes of the ndarray. Different
3
NumPy Reference, Release 2.0.0.dev
ndarrays can share the same data, so that changes made in one ndarray may be visible in another. That is, an
ndarray can be a"view to another ndarray, and the data it is referring to is taken care of by the base "ndarray
ndarrays can also be views to memory owned by Python strings or objects implementing the buffer or array
interfaces
Example
A 2-dimensional array of size 2x 3, composed of 4-byte integer elements:
>>>x=np. array([1,;2,3],[4,5,6]],np.int32)
>>>type(x)
d
shape
(2,3
>>>xdtype
(′int32′)
The array can be indexed using Python container- like syntax
>>>x[1,2] #i.c., the element of x in the *second* row, *third+
For example slicing can produce views of the array
([2,5])
[0]=9 this dlso changes Lhe corresponding element in x
>>>y
array(「9,51)
array([[
[4,5,6]1)
1.1.1 Constructing arrays
New arrays can be constructed using the routines detailed in Array creation routines, and also by using the low-level
ndarray constructor
ndarray An array object represents a multidimensional, homogeneous array of fixed-size items
class numpy. ndarray
An array object represents a multidimensional, homogeneous array of fixed-size items. An associated data-type
object describes the format of each element in the array(its byte-order, how many bytes it occupies in memory,
whether it is an integer, a Hoating point number, or something else, etc.
Arrays should be constructed using array, zeros or empty(refer to the See Also section below ) The parameters
given here refer to a low-level method (ndarray(.) for instantiating an array
For more information, refer to the numpy module and examine thethe methods and attributes of an array
Parameters
(for the new method; see Notes below)
shape: tuple of ints
Shape of created array
dtype: data-type, optional
Any object that can be interpreted as a numpy data type
Chapter 1. Array objects
NumPy Reference, Release 2.0.0.dev
buffer: object exposing buffer interface, optional
Used to fill the array with data
offset: int, optional
Offset of array data in buffer
strides: tuple of ints, optional
Strides of data in memory
order
C’,F}, optional
Row-major or coluInn-najor order.
See also:
array
Construct an array.
ze。s
Create an array each element of which is zero
empt
Create an array, but leave its allocated memory unchanged (i. e, it contains garbage")
atype
Create a data-type
Notes
There are two
des of creating an array using
new
1. f buffer is None, then only shape, dtype, and order are used
2. If buffer is an object exposing the buffer interface, then all key words are interpreted
No_init method is needed because the array is fully initialized after the_ new method
Examples
These examples illustrate the low-level ndarray constructor. Refer to the See Also section above for easier ways
of constructing an ndarray
First mode, buffer is No
>> rp.ndarray(shape-(2, 2), dtype-float, order-F')
array([[-1.13698227e+002
4.25087011e-303]
「2.88528414e-306,3.27025015e-30911)
frandor
p.ndarray((2,), buff
offset=np. int_().itemsize,
dtype=int)# offset =I*itemsize, i.e. skip first element
array([2, 31)
1.1. The N-dimensional array( ndarray)
NumPy Reference, Release 2.0.0.dev
Attributes
data
atype
Create a data type object
flags
flat
imag(val)
Return the imaginary part of the elements of the array
real(val)
Return the real part of the elements of the array
size(al, axis] Return the number of elements along a given axis
itemsize
nbytes
Base object for a dictionary for look-up with any alias for an array dtype.
ndim(a)
Return the number of dimensions of an array.
shape(a)
Return the shape of an array
trides
ctypes
base
class numpy dtype
Create a data ty
A numpy array is homogeneous, and contains elements described by a dtype object. a dtype object can be
constructed from different combinations of fundamental numeric types
Parameters
0
Object to be converted to a data type object
align: bool, optional
Add padding to the fields to match what a C compiler would output for a similar C-
struct. Can be True only if obj is a dictionary or a comma-separated string
copy: bool, optional
Make a new copy of the data-type object. If False, the result may just be a reference
uilt-in data-type object
Examples
Using array-scalar type:
>>>np. d=ype(np int16)
dtype(in-16′)
Record. one field name fl. containing int 6
np.d-y9e([(′1′,np.inL16)])
dtype(「("f1′,>>np.d=yoe([("f1′,[(f1′,np.int16)])])
slype([(1′,[(′1′,〃>> np. d=ype([(fl, npuint),(f2 , np. int 32)1)
dlype([('ll
⊥4′)])
Chapter 1. Array objects
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.