【Python】power
来源:互联网 发布:淘宝店铺营销 编辑:程序博客网 时间:2024/06/11 17:00
numpy.power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'power'>
First array elements raised to powers from second array, element-wise.
Raise each base in x1 to the positionally-corresponding power in x2. x1 and x2 must be broadcastable to the same shape. Note that an integer type raised to a negative integer power will raise a ValueError.
Parameters:
x1 : array_like
The bases.
x2 : array_like
The exponents.
out : ndarray, None, or tuple of ndarray and None, optional
A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs.
where : array_like, optional
Values of True indicate to calculate the ufunc at that position, values of False indicate to leave the value in the output alone.
**kwargs
For other keyword-only arguments, see the ufunc docs.
Returns:
y : ndarray
The bases in x1 raised to the exponents in x2.
Cube each element in a list.
>>> x1 = range(6)>>> x1[0, 1, 2, 3, 4, 5]>>> np.power(x1, 3)array([ 0, 1, 8, 27, 64, 125])
Raise the bases to different exponents.
>>> x2 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0]>>> np.power(x1, x2)array([ 0., 1., 8., 27., 16., 5.])
The effect of broadcasting.
>>> x2 = np.array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]])>>> x2array([[1, 2, 3, 3, 2, 1], [1, 2, 3, 3, 2, 1]])>>> np.power(x1, x2)array([[ 0, 1, 8, 27, 16, 5], [ 0, 1, 8, 27, 16, 5]])
- 【Python】power
- 231. Power of Two python
- Python checkio Index Power解决方案
- The power of Python's yield
- [python语法巩固][leetcode326][Power of Three]
- 231. Power of Two [easy] (Python)
- 326. Power of Three [easy] (Python)
- 342. Power of Four [easy] (Python)
- leetcode(11),Power of Three(python)
- 342. Power of Four【easy】【python】
- [leetcode: Python]231. Power of Two
- [leetcode: Python]326.Power of Three
- [leetcode: Python]342. Power of Four
- power
- power
- power
- Power
- Power
- dubbo原理系列3-consumer调用过程
- [置顶]微信开发详细教程
- java 线程间交换数据的Exchanger
- 【连接数据库】PHP7的连接数据库的三种方法【原创】
- 如何用Maven构建一个project(二)—创建Web项目
- 【Python】power
- 进度条下方显示进度Tag
- Tomcat下运行web项目出现Cannot load JDBC driver class 'oracle.jdbc.driver.OracleDriver'
- sql基础之存储过程
- Retrofit(OKHttp)多BaseUrl情况下url实时自动替换完美解决方法
- HDOJ-2222 (AC自动机模板)
- Android 实现某控件旋转(中心点旋转)
- Python中的axis=0,axis=1
- 公司开发者账号申请(2017最新版)