Iv. NumPy Basics: Array Operations

Source: Internet
Author: User
Tags arithmetic

First, the vector operation
    • Arrays perform bulk arithmetic operations on each element without looping, a process called vectorization, which is the practice of replacing loops with array expressions.
    • The vectorized array performs one or two data levels faster than a pure Python method.
    • Any arithmetic operation between two arrays of equal size will apply their operations to the action at the element level.

element-level operations: in NumPy, an operation between an array of equal size, an element-level operation, which is used only between elements of the same position, results in a new array, with the result of the operation having the same position as the operand.

Type Function Operator Description
Base operations Add (A,b[,c]) C=a+b Addition
Subtract (A,b[,c]) C=a-b Subtraction
Multiply (A,b[,c]) C=a*b Multiplication
Divide (A,b[,c]) C=a/b Division (in Python3, divide is the same as true_divide usage)
Floor_divide (A,b[,c]) c=a//b Division, the result is rounded down
Negative (A[,c]) C=-a Take counter
Power (A,b[,c]) C=a**b A's B-square
Remainder (A,b[,c]) C=a%b Modulo (can also be written mod (A,B[,C)))
Fmod (A,b[,c]) None Signed modulo, plus or minus a decision
Comparison operation Equal (A,b[,c]) C=a==b Comparison result C is a Boolean array
Not_equal (A,b[,c]) C=a!=b
Less (A,b[,c]) C=a<b
Less_equal (A,b[,c]) C=a<=b
Greater (A,b[,c]) C=a>b
Greater_equal (A,b[,c]) C=a>=b
Statistical operations SUM (A[,axis,c]) None Sum: Statistical dimensions can be defined by axis parameters
Min (A[,axis,c]) None Minimum: Statistical dimensions can be defined by axis parameters
Max (A[,axis,c]) None Maximum: Statistical dimensions can be defined by axis parameters
Mean (A[,axis,c]) None Average: Statistical dimensions can be defined by axis parameters
STD (A[,axis,c]) None Standard deviation: Statistical dimensions can be defined by axis parameters
var (a[,axis,c]) None Variance: Statistical dimensions can be defined by axis parameters
Median (A[,axis,c]) None Median: Statistical dimensions can be defined by axis parameters
PTP (A[,axis,c]) None Extreme difference: The difference between the minimum value of the maximum value
diff (A[,axis,c]) None Discrete difference: An array of difference values of adjacent array elements
Trigonometric operations Sin (a[,axis,c]), Arcsin (A[,axis,c]) None Sine (inverse chord)
cos (a[,axis,c]), Arccos (A[,axis,c]) None Cosine (Inverse cosine)
Tan (A[,axis,c]), arctan (A[,axis,c]) None Tangent (Arc tangent)
Sinh (A[,axis,c]), Arcsinh (A[,axis,c]) None Hyperbolic sine (inverse hyperbolic sine)
Cosh (A[,axis,c]), Arccosh (A[,axis,c]) None Hyperbolic cosine (inverse hyperbolic cosine)
Tanh (A[,axis,c]), Arctanh (A[,axis,c]) None Hyperbolic tangent (inverse hyperbolic tangent)
Logarithmic operations Log (A[,axis,c]) None The pair value of base a of E
LOG2 (A[,axis,c]) None Pairs of values with base a of 2
LOG10 (A[,axis,c]) None Pairs of values with base a of 10
LOG1P (A[,axis,c]) None The pairs of values with E as the base a+1

Second, built-in functions

Iv. NumPy Basics: Array Operations

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.