Generating functions |
Role |
Np.array (x) Np.array (x, Dtype) |
Convert input data to a Ndarray Convert input data to a type of Ndarray |
Np.asarray (Array) |
Convert input data to a new (copy) Ndarray |
Np.ones (N) Np.ones (N, Dtype) Np.ones_like (Ndarray) |
Generates an n-length one-dimensional all-one ndarray Generating an N-length type is a one-dimensional all-one ndarray of Dtype Create a ndarray with the same shape as the parameter |
Np.zeros (N) Np.zeros (N, Dtype) Np.zeros_like (Ndarray) |
Generates an n-length one-dimensional full 0 Ndarray Generates an n-length type bit dtype one-dimensional full 0 Ndarray Similar to Np.ones_like (Ndarray) |
Np.empty (N) Np.empty (N, Dtype) Np.empty (Ndarray) |
Generates an uninitialized one-dimensional ndarray of N-length Generates an n-length type that is an uninitialized one-dimensional ndarray of Dtype Similar to Np.ones_like (Ndarray) |
Np.eye (N) Np.identity (N) |
Create an n * N unit Matrix (diagonal is 1, the remainder is 0) |
Np.arange (num) Np.arange (begin, end) Np.arange (begin, end, step) |
Generate a one-dimensional ndarray from 0 to num-1 steps 1 Generate a one-dimensional ndarray from begin to end-1 steps 1 Build a one-dimensional ndarray that steps from begin to End-step are step |
Np.mershgrid (Ndarray, Ndarray,...) |
Generate a Ndarray * Ndarray * ... The Multidimensional Ndarray |
Np.where (Cond, Ndarray1, Ndarray2) |
Depending on the condition cond, select Ndarray1 or Ndarray2 to return a new Ndarray |
NP.IN1D (Ndarray, [x, y,...]) |
Checks if the elements in the Ndarray are equal to [x, y,...] Returns a bool array in one of the |
|
|
Matrix functions |
Description |
Np.diag (Ndarray) Np.diag ([x, y,...]) |
Returns a diagonal (or non-diagonal) element of a square matrix as a one-dimensional array Converts a one-dimensional array to a square (non-diagonal element is 0) |
Np.dot (Ndarray, Ndarray) |
Matrix multiplication |
Np.trace (Ndarray) |
Computes the and of the diagonal elements |
|
|
|
|
Sort function |
Description |
Np.sort (Ndarray) |
Sort, return copy |
Np.unique (Ndarray) |
Returns the elements in Ndarray, excludes duplicate elements, and sorts |
NP.INTERSECT1D (Ndarray1, Ndarray2) NP.UNION1D (Ndarray1, Ndarray2) NP.SETDIFF1D (Ndarray1, Ndarray2) NP.SETXOR1D (Ndarray1, Ndarray2) |
Returns the intersection of the two and sorts. Returns the combination of the two and sorts. Returns the difference between the two. Returns the symmetry difference between the two |
|
|
Unary calculation function |
Description |
Np.abs (Ndarray) Np.fabs (Ndarray) |
Calculate absolute Value Calculate absolute value (non-plural) |
Np.mean (Ndarray) |
Averaging |
NP.SQRT (Ndarray) |
Calculate x^0.5 |
Np.square (Ndarray) |
Calculate x^2 |
Np.exp (Ndarray) |
Calculate e^x |
Log, log10, log2, log1p |
Log with natural logarithm, bottom 10 log, bottom 2 log, bottom (1+x) |
Np.sign (Ndarray) |
Calculate positive and negative numbers: 1 (positive), 0 (0), 1 (negative) |
Np.ceil (Ndarray) Np.floor (Ndarray) Np.rint (Ndarray) |
Calculates the smallest integer greater than or equal to the value Calculates the largest integer less than or equal to the value Rounding to the nearest integer, preserving Dtype |
NP.MODF (Ndarray) |
Returns the decimal and integer parts of an array as two independent arrays |
Np.isnan (Ndarray) |
Returns a bool array that determines whether it is Nan |
Np.isfinite (Ndarray) Np.isinf (Ndarray) |
Returns a Boolean array that determines whether it is a poor (non-INF, non-Nan) Returns an array of type bool that determines whether it is infinite |
Cos, cosh, sin, sinh, tan, Tanh |
General type and hyperbolic trigonometric functions |
Arccos, Arccosh, Arcsin, Arcsinh, Arctan, Arctanh |
Inverse trigonometric function and hyperbolic type inverse trigonometric function |
Np.logical_not (Ndarray) |
Calculates the true value of not x for each element, equivalent to-ndarray |
Multivariate computational functions |
Description |
Np.add (Ndarray, Ndarray) Np.subtract (Ndarray, Ndarray) Np.multiply (Ndarray, Ndarray) Np.divide (Ndarray, Ndarray) Np.floor_divide (Ndarray, Ndarray) Np.power (Ndarray, Ndarray) Np.mod (Ndarray, Ndarray) |
Add Subtraction Multiplication Division Circle Divide Method (discard remainder) Sub-party Die-finding |
Np.maximum (Ndarray, Ndarray) Np.fmax (Ndarray, Ndarray) Np.minimun (Ndarray, Ndarray) Np.fmin (Ndarray, Ndarray) |
To find the maximum value Maximum value (Ignore Nan) To find the minimum value Minimum value (Ignore Nan) |
Np.copysign (Ndarray, Ndarray) |
Assigning the symbol in Parameter 2 to parameter 1 |
Np.greater (Ndarray, Ndarray) Np.greater_equal (Ndarray, Ndarray) Np.less (Ndarray, Ndarray) Np.less_equal (Ndarray, Ndarray) Np.equal (Ndarray, Ndarray) Np.not_equal (Ndarray, Ndarray) |
> >= < <= == != |
Logical_and (Ndarray, Ndarray) Logical_or (Ndarray, Ndarray) Logical_xor (Ndarray, Ndarray) |
& | ^ |
Np.dot (Ndarray, Ndarray) |
Calculating the matrix inner product of two Ndarray |
Np.ix_ ([x,y,m,n],...) |
Generates an indexer for fancy indexing (fancy index) |
|
|
File read/write |
Description |
Np.save (String, Ndarray) |
Save Ndarray to file named [String].npy] (no compression) |
Np.savez (String, Ndarray1, Ndarray2, ...) |
Save all Ndarray compression to a file named [String].npy] |
Np.savetxt (sring, Ndarray, FMT, newline= ' \ n ') |
Write Ndarray to file in FMT format |
Np.load (String) |
Reads the file contents of a filename string and translates it into a Ndarray object (or Dictionary object) |
Np.loadtxt (String, delimiter) |
Reads the file contents of the filename string, converting it to ndarray with delimiter as a delimiter |