Python--numpy Study (i)

Source: Internet
Author: User

The NumPy section functions as follows:

    • Ndarray, a fast space-saving multidimensional array with vector operators and complex broadcast capabilities
    • Standard mathematical function for fast operation of array data
    • Tools for reading and writing disk data and tools for manipulating memory-mapped files
    • Linear algebra, random number generation and Fourier transform functions
    • Tools for inheriting code written in C, C + +, Fortran, and other languages

One of the most important features of NumPy is its n-dimensional array object (Ndarray), which is a fast and flexible large data set container. This array object can be used to perform some mathematical operations on the entire block of data, with the same syntax as the scalar operation.

in [5]: Import NumPy asNpin [6]: Data=np.array ([[0.9526,-0.246,-0.8856],[0.5639,0.2379,0.9104]]) in [7]: dataout[7]:array ([[0.9526, -0.246, -0.8856],       [ 0.5639,0.2379,0.9104]]) in [8]: Data *Tenout[8]:array ([[9.526, -2.46, -8.856],       [ 5.639,2.379,9.104]]) in [9]: Data +dataout[9]:array ([[1.9052, -0.492, -1.7712],       [ 1.1278,0.4758,1.8208]])

Ndarray is a generic homogeneous data multidimensional container in which all elements must be of the same type. Each array has a shape (a tuple that represents a dimension size) and a dtype (an object that describes the array data type)

in [ in]: Test_data=np.array ([[1,2,3],[4,5,6],[7,8,9]]) in [ -]: dataout[ -]:array ([[0.9526, -0.246, -0.8856],       [ 0.5639,0.2379,0.9104]]) in [ to]: test_dataout[ to]:array ([[1,2,3],       [4,5,6],       [7,8,9]]) in [ +]: data.shapeout[ +]: (2,3) #表示2行3列In [ -]: test_data.shapeout[ -]: (3,3) #表示3行3列
In [the]: data.dtypeout[: Dtype ('float64') in [  * ]: test_data.dtypeout[: Dtype ('int32')
Create Ndarry

The simplest way to create an array is to use the array function. It accepts all sequences of objects (including other arrays) and then produces a new NumPy array of incoming data.

Python--numpy Study (i)

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.