One: NumPy module
Ndarray: A multidimensional array that stores a single data type
Ufunc: functions capable of handling arrays (Universal function Object)
# ) Re_arange_array =arange_ Array.reshape (2,5) # print " arange_array is Array,it ' s%s "%< Span style= "color: #000000;" > Arange_array print " re_arange_array is:%s % Re_arange_array
#linspace函数通过指定开始值, end value, and number of elements to create a one-dimensional array, you can specify the #是否包括终值 with the endpoint keyword, the default setting is to include the final value: Linspace_array=np.linspace (0, 1, 12) # The arithmetic progression is created! Print "Linspace_array is:%s"% Linspace_array
# Logspace creates the geometric series, produces the starting value 10^ the start value, to the 10^ termination value, and the one-dimensional array of n values logspace_array=np.logspace (0,2,30Print " logspace array is:%s " % Logspace_array
defreturn (i+1) * (j+1) b=np.fromfunction (fun2, (9,9# FromFunction creates an array from a function, a custom function, and an array from a function; # the FROMPYFUNC call format is Frompyfunc (func, Nin, Nout), Nin is the number of input parameters for this function, and Nout is the number of return values for this function. print'b is:%s' %b
Data Type Objects (Dtype) and structure array
Data type Object, ie. An instance of Numpy.dtype describes how an array object resolves a fixed-size memory segment in memory. It depicts several aspects of the data:
- Type of data (integer, float, Python object, etc.)
- The size of the data (how many bytes was in e.g. the integer)
- Bits Order of storage (Little-endian or Big-endian)
- If the data type is a record, that is, a combination of other data types (e.g., describing an array item consisting of an integer and a float), which is similar to the struct in C language.
- What is the name of the individual data that is logged, and how to get the child data.
- What is the type of each child data.
- What portion of memory is used for each child data.
- If the data is a sub-array, what is its shape.
ImportNumPy as Np;persontype=np.dtype ({'names':['name',' Age','Weight'],'formats':['S32','I','F']}) a= Np.array ([("Zhuang", 32,75.5), ("Wang", 24,65.2)],dtype=PersonType)Printa[1]['name']PrintA.strides
Python--numpy module, spicy module, matplotlib module