Python--numpy module, spicy module, matplotlib module

Source: Internet
Author: User

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:

    1. Type of data (integer, float, Python object, etc.)
    2. The size of the data (how many bytes was in e.g. the integer)
    3. Bits Order of storage (Little-endian or Big-endian)
    4. 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.
  1. What is the name of the individual data that is logged, and how to get the child data.
  2. What is the type of each child data.
  3. What portion of memory is used for each child data.
    1. 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.