"Data analysis Using Python" chapter 4th study Notes

Source: Internet
Author: User
Tags scalar
NumPy Base: Array and Vector computing NumPy Ndarray: a multidimensional Array object

This object is a fast and flexible large data set container. You can use this array to perform some mathematical operations on the whole piece of data, which is the same syntax as a scalar element.

List conversions to arrays

Two-dimensional list

Data type

Some other auto-generated arrays

Arange ()

Data types for Ndarray

Using the Astype () method to convert a type, if a floating-point number is converted to an integer, the fractional part is truncated, and if a string array is full of numbers, it can also be converted to numeric form

Operations between arrays and scalars

Arrays are important because they allow you to perform bulk operations on the main clause without having to write loops. This is often called vectorization. Any arithmetic operation between arrays of equal size applies the operation to the element level.

The array is the product of each number in the corresponding position, and the array can be subtraction with the scalar.

The operations between arrays of different sizes are called broadcasts.

Basic indexes and slices

Like a list in Python, an array slice is a view of the original array.

Arr[0][2]arr[0,2] These two are the same
Boolean index

You can use! =,-, or &,| to perform the operation.

Fancy Index

Refers to the use of an integer array for indexing.

Array Transpose and Axisymmetric

Arr. T

Np.dot (arr. T,arr) Calculating the inner product

The transpose of the high-level array is not quite clear.

There is also a swapaxes method that needs to accept a pair of axis numbers. Don't quite understand

General functions: Fast element Progression Group functions

Using Arrays for data processing

Vectorization: The practice of replacing loops with array expressions.

"Data analysis Using Python" chapter 4th study Notes

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.