Numpy数组常用函数汇总(数学运算、三角函数、位运算、比较运算及其它)
生活随笔
收集整理的這篇文章主要介紹了
Numpy数组常用函数汇总(数学运算、三角函数、位运算、比较运算及其它)
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
一、數(shù)學運算
| add(x1, x2, [, out, where, casting, order, …]) | Add arguments element-wise. | 按元素添加參數(shù)。 |
| subtract(x1, x2, [, out, where, casting, …]) | Subtract arguments, element-wise. | 從元素角度減去參數(shù)。 |
| multiply(x1, x2, [, out, where, casting, …]) | Multiply arguments element-wise. | 將參數(shù)逐元素相乘。 |
| matmul(x1, x2, [, out, casting, order, …]) | Matrix product of two arrays. | 兩個數(shù)組的矩陣乘積。 |
| divide(x1, x2, [, out, where, casting, …]) | Returns a true division of the inputs, element-wise. | 以元素為單位返回輸入的真實除法。 |
| logaddexp(x1, x2, [, out, where, casting, …]) | Logarithm of the sum of exponentiations of the inputs. | 輸入取冪之和的對數(shù)。 |
| logaddexp2(x1, x2, [, out, where, casting, …]) | Logarithm of the sum of exponentiations of the inputs in base-2. | 以2為底的輸入的冪和的對數(shù)。 |
| true_divide(x1, x2, [, out, where, …]) | Returns a true division of the inputs, element-wise. | 以元素為單位返回輸入的真實除法。 |
| floor_divide(x1, x2, [, out, where, …]) | Return the largest integer smaller or equal to the division of the inputs. | 返回小于或等于輸入除法的最大整數(shù)。 |
| negative(x, [, out, where, casting, order, …]) | Numerical negative, element-wise. | 數(shù)值為負數(shù),逐元素。 |
| positive(x, [, out, where, casting, order, …]) | Numerical positive, element-wise. | 數(shù)值正數(shù),逐元素。 |
| power(x1, x2, [, out, where, casting, …]) | First array elements raised to powers from second array, element-wise. | 第一個數(shù)組元素在元素方面從第二個數(shù)組提升為冪。 |
| float_power(x1, x2, [, out, where, …]) | First array elements raised to powers from second array, element-wise. | 第一個數(shù)組元素在元素方面從第二個數(shù)組提升為冪。 |
| remainder(x1, x2, [, out, where, casting, …]) | Return element-wise remainder of division. | 返回元素的除法余數(shù)。 |
| mod(x1, x2, [, out, where, casting, order, …]) | Return element-wise remainder of division. | 返回元素的除法余數(shù)。 |
| fmod(x1, x2, [, out, where, casting, …]) | Return the element-wise remainder of division. | 返回元素的除法余數(shù)。 |
| divmod(x1, x2[, out1, out2], [, out, …]) | Return element-wise quotient and remainder simultaneously. | 同時返回元素商和余數(shù)。 |
| absolute(x, [, out, where, casting, order, …]) | Calculate the absolute value element-wise. | 按元素計算絕對值。 |
| fabs(x, [, out, where, casting, order, …]) | Compute the absolute values element-wise. | 按元素計算絕對值。 |
| rint(x, [, out, where, casting, order, …]) | Round elements of the array to the nearest integer. | 將數(shù)組的元素四舍五入到最接近的整數(shù)。 |
| sign(x, [, out, where, casting, order, …]) | Returns an element-wise indication of the sign of a number. | 返回數(shù)字符號的逐元素指示。 |
| heaviside(x1, x2, [, out, where, casting, …]) | Compute the Heaviside step function. | 計算Heaviside階躍函數(shù)。 |
| conj(x, [, out, where, casting, order, …]) | Return the complex conjugate, element-wise. | 逐元素返回復共軛。 |
| conjugate(x, [, out, where, casting, …]) | Return the complex conjugate, element-wise. | 逐元素返回復共軛。 |
| exp(x, [, out, where, casting, order, …]) | Calculate the exponential of all elements in the input array. | 計算輸入數(shù)組中所有元素的指數(shù)。 |
| exp2(x, [, out, where, casting, order, …]) | Calculate 2**p for all p in the input array. | 為輸入數(shù)組中的所有p計算2 ** p。 |
| log(x, [, out, where, casting, order, …]) | Natural logarithm, element-wise. | 自然對數(shù),逐元素。 |
| log2(x, [, out, where, casting, order, …]) | Base-2 logarithm of x. | x的以2為底的對數(shù)。 |
| log10(x, [, out, where, casting, order, …]) | Return the base 10 logarithm of the input array, element-wise. | 以元素為單位返回輸入數(shù)組的以10為底的對數(shù)。 |
| expm1(x, [, out, where, casting, order, …]) | Calculate exp(x) - 1 for all elements in the array. | 為數(shù)組中的所有元素計算exp(x)-1。 |
| log1p(x, [, out, where, casting, order, …]) | Return the natural logarithm of one plus the input array, element-wise. | 返回元素加一個輸入數(shù)組的自然對數(shù)。 |
| sqrt(x, [, out, where, casting, order, …]) | Return the non-negative square-root of an array, element-wise. | 以元素為單位返回數(shù)組的非負平方根。 |
| square(x, [, out, where, casting, order, …]) | Return the element-wise square of the input. | 返回輸入的元素方平方。 |
| cbrt(x, [, out, where, casting, order, …]) | Return the cube-root of an array, element-wise. | 返回元素的數(shù)組的立方根。 |
| reciprocal(x, [, out, where, casting, …]) | Return the reciprocal of the argument, element-wise. | 以元素為單位返回參數(shù)的倒數(shù)。 |
| gcd(x1, x2, [, out, where, casting, order, …]) | Returns the greatest common divisor of |x1| and |x2| | 返回| x1 |的最大公約數(shù)。和| x2 | |
| lcm(x1, x2, [, out, where, casting, order, …]) | Returns the lowest common multiple of |x1| and |x2| | 返回| x1 |的最小公倍數(shù)和| x2 | |
二、三角函數(shù)
| sin(x, [, out, where, casting, order, …]) | Trigonometric sine, element-wise. | 三角正弦,元素方式。 |
| cos(x, [, out, where, casting, order, …]) | Cosine element-wise. | 余弦元素。 |
| tan(x, [, out, where, casting, order, …]) | Compute tangent element-wise. | 按元素計算切線。 |
| arcsin(x, [, out, where, casting, order, …]) | Inverse sine, element-wise. | 按元素反正弦。 |
| arccos(x, [, out, where, casting, order, …]) | Trigonometric inverse cosine, element-wise. | 三角反余弦,元素方式。 |
| arctan(x, [, out, where, casting, order, …]) | Trigonometric inverse tangent, element-wise. | 三角逆切線,元素方向。 |
| arctan2(x1, x2, [, out, where, casting, …]) | Element-wise arc tangent of x1/x2 choosing the quadrant correctly. | 正確選擇象限的x1 / x2的逐元素反正切。 |
| hypot(x1, x2, [, out, where, casting, …]) | Given the “l(fā)egs” of a right triangle, return its hypotenuse. | 給定直角三角形的“腿”,返回其斜邊。 |
| sinh(x, [, out, where, casting, order, …]) | Hyperbolic sine, element-wise. | 雙曲正弦,逐元素。 |
| cosh(x, [, out, where, casting, order, …]) | Hyperbolic cosine, element-wise. | 雙曲余弦,元素方式。 |
| tanh(x, [, out, where, casting, order, …]) | Compute hyperbolic tangent element-wise. | 計算雙曲正切元素。 |
| arcsinh(x, [, out, where, casting, order, …]) | Inverse hyperbolic sine element-wise. | 反雙曲正弦元素。 |
| arccosh(x, [, out, where, casting, order, …]) | Inverse hyperbolic cosine, element-wise. | 反雙曲余弦,逐元素。 |
| arctanh(x, [, out, where, casting, order, …]) | Inverse hyperbolic tangent element-wise. | 反雙曲正切元素明智。 |
| degrees(x, [, out, where, casting, order, …]) | Convert angles from radians to degrees. | 將角度從弧度轉(zhuǎn)換為度。 |
| radians(x, [, out, where, casting, order, …]) | Convert angles from degrees to radians. | 將角度從度轉(zhuǎn)換為弧度。 |
| deg2rad(x, [, out, where, casting, order, …]) | Convert angles from degrees to radians. | 將角度從度轉(zhuǎn)換為弧度。 |
| rad2deg(x, [, out, where, casting, order, …]) | Convert angles from radians to degrees. | 將角度從弧度轉(zhuǎn)換為度。 |
三、位操作
| bitwise_and(x1, x2, [, out, where, …]) | Compute the bit-wise AND of two arrays element-wise. | 按元素計算兩個數(shù)組的按位與。 |
| bitwise_or(x1, x2, [, out, where, casting, …]) | Compute the bit-wise OR of two arrays element-wise. | 按元素計算兩個數(shù)組的按位或。 |
| bitwise_xor(x1, x2, [, out, where, …]) | Compute the bit-wise XOR of two arrays element-wise. | 按元素計算兩個數(shù)組的按位XOR。 |
| invert(x, [, out, where, casting, order, …]) | Compute bit-wise inversion, or bit-wise NOT, element-wise. | 按元素計算按位求反,或按位求非。 |
| left_shift(x1, x2, [, out, where, casting, …]) | Shift the bits of an integer to the left. | 向左移動整數(shù)的位。 |
| right_shift(x1, x2, [, out, where, …]) | Shift the bits of an integer to the right. | 向右移整數(shù)的位。 |
四、比較函數(shù)
| greater(x1, x2, [, out, where, casting, …]) | Return the truth value of (x1 > x2) element-wise. | 按元素返回(x1> x2)的真值。 |
| greater_equal(x1, x2, [, out, where, …]) | Return the truth value of (x1 >= x2) element-wise. | 逐元素返回(x1> = x2)的真值。 |
| less(x1, x2, [, out, where, casting, …]) | Return the truth value of (x1 < x2) element-wise. | 按元素返回(x1 <x2)的真值。 |
| less_equal(x1, x2, [, out, where, casting, …]) | Return the truth value of (x1 =< x2) element-wise. | 逐元素返回(x1 = <x2)的真值。 |
| not_equal(x1, x2, [, out, where, casting, …]) | Return (x1 != x2) element-wise. | 按元素返回(x1!= x2)。 |
| equal(x1, x2, [, out, where, casting, …]) | Return (x1 == x2) element-wise. | 按元素返回(x1 == x2)。 |
| logical_and(x1, x2, [, out, where, …]) | Compute the truth value of x1 AND x2 element-wise. | 按元素計算x1和x2的真值。 |
| logical_or(x1, x2, [, out, where, casting, …]) | Compute the truth value of x1 OR x2 element-wise. | 按元素計算x1或x2的真值。 |
| logical_xor(x1, x2, [, out, where, …]) | Compute the truth value of x1 XOR x2, element-wise. | 按元素計算x1 XOR x2的真值。 |
| logical_not(x, [, out, where, casting, …]) | Compute the truth value of NOT x element-wise. | 按元素計算NOT x的真值。 |
| maximum(x1, x2, [, out, where, casting, …]) | Element-wise maximum of array elements. | 數(shù)組元素的逐元素最大值。 |
| minimum(x1, x2, [, out, where, casting, …]) | Element-wise minimum of array elements. | 數(shù)組元素的按元素最小值。 |
| fmax(x1, x2, [, out, where, casting, …]) | Element-wise maximum of array elements. | 數(shù)組元素的逐元素最大值。 |
| fmin(x1, x2, [, out, where, casting, …]) | Element-wise minimum of array elements. | 數(shù)組元素的按元素最小值。 |
五、其它函數(shù)
| isfinite(x, [, out, where, casting, order, …]) | Test element-wise for finiteness (not infinity or not Not a Number). | 逐一測試有限性(不是無窮大還是不是數(shù)字)。 |
| isinf(x, [, out, where, casting, order, …]) | Test element-wise for positive or negative infinity. | 逐元素測試正無窮大或負無窮大。 |
| isnan(x, [, out, where, casting, order, …]) | Test element-wise for NaN and return result as a boolean array. | 對NaN逐個元素進行測試,并以布爾數(shù)組返回結(jié)果。 |
| isnat(x, [, out, where, casting, order, …]) | Test element-wise for NaT (not a time) and return result as a boolean array. | 對NaT(不是時間)逐個元素進行測試,并將結(jié)果作為布爾數(shù)組返回。 |
| fabs(x, [, out, where, casting, order, …]) | Compute the absolute values element-wise. | 按元素計算絕對值。 |
| signbit(x, [, out, where, casting, order, …]) | Returns element-wise True where signbit is set (less than zero). | 返回設置有符號位(小于零)的元素級True。 |
| copysign(x1, x2, [, out, where, casting, …]) | Change the sign of x1 to that of x2, element-wise. | 逐元素地將x1的符號更改為x2的符號。 |
| nextafter(x1, x2, [, out, where, casting, …]) | Return the next floating-point value after x1 towards x2, element-wise. | 將x1之后的下一個浮點值向x2逐元素返回。 |
| spacing(x, [, out, where, casting, order, …]) | Return the distance between x and the nearest adjacent number. | 返回x與最接近的相鄰數(shù)字之間的距離。 |
| modf(x[, out1, out2], [, out, where, …]) | Return the fractional and integral parts of an array, element-wise. | 以元素為單位返回數(shù)組的小數(shù)和整數(shù)部分。 |
| ldexp(x1, x2, [, out, where, casting, …]) | Returns x1 * 2**x2, element-wise. | 按元素返回x1 * 2 ** x2。 |
| frexp(x[, out1, out2], [, out, where, …]) | Decompose the elements of x into mantissa and twos exponent. | 將x的元素分解為尾數(shù)和二進制指數(shù)。 |
| fmod(x1, x2, [, out, where, casting, …]) | Return the element-wise remainder of division. | 返回元素的除法余數(shù)。 |
| floor(x, [, out, where, casting, order, …]) | Return the floor of the input, element-wise. | 以元素為單位返回輸入的底限。 |
| ceil(x, [, out, where, casting, order, …]) | Return the ceiling of the input, element-wise. | 以元素為單位返回輸入的上限。 |
| trunc(x, [, out, where, casting, order, …]) | Return the truncated value of the input, element-wise. | 以元素為單位返回輸入的截斷值。 |
總結(jié)
以上是生活随笔為你收集整理的Numpy数组常用函数汇总(数学运算、三角函数、位运算、比较运算及其它)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Matlab和Python(Numpy,
- 下一篇: sklearn快速入门教程:补充内容 -