pandas.Series.rdiv#

Series.rdiv(other, level=None, fill_value=None, axis=0)[源代码]#

返回按元素(二元运算符)的级数和其他的浮点除法 rtruediv )。

相当于 other / series ,但支持用FILL_VALUE替换任一输入中缺失的数据。

参数
other序列或标量值
fill_value无或浮点值,默认为无(NaN)

在计算之前,使用此值填充现有的缺失(NAN)值以及成功的系列对齐所需的任何新元素。如果两个相应的系列位置中的数据都丢失,则(在该位置)填充的结果也将丢失。

level整型或名称

跨级别广播,匹配传递的多索引级别上的索引值。

退货
系列

手术的结果。

参见

Series.truediv

按元素进行浮点除法,请参见 Python documentation 了解更多详细信息。

示例

>>> a = pd.Series([1, 1, 1, np.nan], index=['a', 'b', 'c', 'd'])
>>> a
a    1.0
b    1.0
c    1.0
d    NaN
dtype: float64
>>> b = pd.Series([1, np.nan, 1, np.nan], index=['a', 'b', 'd', 'e'])
>>> b
a    1.0
b    NaN
d    1.0
e    NaN
dtype: float64
>>> a.divide(b, fill_value=0)
a    1.0
b    inf
c    inf
d    0.0
e    NaN
dtype: float64