flash网站模板 asp,如何制作简单网站,在建设银行网站上还贷,阿里云网站目录
一、用法精讲
116、pandas.Series.div方法
116-1、语法
116-2、参数
116-3、功能
116-4、返回值
116-5、说明
116-6、用法
116-6-1、数据准备
116-6-2、代码示例
116-6-3、结果输出
117、pandas.Series.truediv方法
117-1、语法
117-2、参数
117-3、功能
…目录
一、用法精讲
116、pandas.Series.div方法
116-1、语法
116-2、参数
116-3、功能
116-4、返回值
116-5、说明
116-6、用法
116-6-1、数据准备
116-6-2、代码示例
116-6-3、结果输出
117、pandas.Series.truediv方法
117-1、语法
117-2、参数
117-3、功能
117-4、返回值
117-5、说明
117-6、用法
117-6-1、数据准备
117-6-2、代码示例
117-6-3、结果输出
118、pandas.Series.floordiv方法
118-1、语法
118-2、参数
118-3、功能
118-4、返回值
118-5、说明
118-6、用法
118-6-1、数据准备
118-6-2、代码示例
118-6-3、结果输出
119、pandas.Series.mod方法
119-1、语法
119-2、参数
119-3、功能
119-4、返回值
119-5、说明
119-6、用法
119-6-1、数据准备
119-6-2、代码示例
119-6-3、结果输出
120、pandas.Series.pow方法
120-1、语法
120-2、参数
120-3、功能
120-4、返回值
120-5、说明
120-6、用法
120-6-1、数据准备
120-6-2、代码示例
120-6-3、结果输出
二、推荐阅读
1、Python筑基之旅
2、Python函数之旅
3、Python算法之旅
4、Python魔法之旅
5、博客个人主页 一、用法精讲
116、pandas.Series.div方法
116-1、语法
# 116、pandas.Series.div方法
pandas.Series.div(other, levelNone, fill_valueNone, axis0)
Return Floating division of series and other, element-wise (binary operator truediv).Equivalent to series / other, but with support to substitute a fill_value for missing data in either one of the inputs.Parameters:
other
Series or scalar value
level
int or name
Broadcast across a level, matching Index values on the passed MultiIndex level.fill_value
None or float value, default None (NaN)
Fill existing missing (NaN) values, and any new element needed for successful Series alignment, with this value before computation. If data in both corresponding Series locations is missing the result of filling (at that location) will be missing.axis
{0 or ‘index’}
Unused. Parameter needed for compatibility with DataFrame.Returns:
Series
The result of the operation.
116-2、参数
116-2-1、other(必须)标量、Series或DataFrame表示要除以的值可以是一个标量、另一个Series或DataFrame如果是Series或DataFrame则会根据索引进行对齐。
116-2-2、level(可选默认值为None)一个整数或字符串如果other是一个MultiIndex的Series或DataFrame使用该参数可以指定索引的哪个层进行对齐传入的值应该是层的级别的名称或位置(索引值)。
116-2-3、fill_value(可选默认值为None)标量值当对齐时如果某个Series中的某个索引值在另一个Series中不存在可以通过此参数提供一个填充值以在计算时替换缺失值默认为None即缺失值会返回NaN。
116-2-4、axis(可选默认值为0)当other是DataFrame时此参数指定沿哪个轴进行操作对于Series通常不需要使用此参数默认值为0。
116-3、功能 用于执行元素级除法的函数它可以将当前Series的每个元素除以另一个Series或标量值。
116-4、返回值 返回一个新的Series其中包含除法运算的结果。如果参与运算的两个对象没有相同的索引结果中缺失的索引会被填充为NaN(若未设置fill_value)。
116-5、说明 无
116-6、用法
116-6-1、数据准备
无
116-6-2、代码示例
# 116、pandas.Series.div方法
import pandas as pd
# 创建一个Series
s1 pd.Series([10, 20, 30], index[a, b, c])
s2 pd.Series([1, 2, 3], index[a, b, d])
# 使用div方法
result s1.div(s2, fill_value0)
print(result)
116-6-3、结果输出
# 116、pandas.Series.div方法
# a 10.0
# b 10.0
# c inf
# d 0.0
# dtype: float64
117、pandas.Series.truediv方法
117-1、语法
# 117、pandas.Series.truediv方法
pandas.Series.truediv(other, levelNone, fill_valueNone, axis0)
Return Floating division of series and other, element-wise (binary operator truediv).Equivalent to series / other, but with support to substitute a fill_value for missing data in either one of the inputs.Parameters:
other
Series or scalar value
level
int or name
Broadcast across a level, matching Index values on the passed MultiIndex level.fill_value
None or float value, default None (NaN)
Fill existing missing (NaN) values, and any new element needed for successful Series alignment, with this value before computation. If data in both corresponding Series locations is missing the result of filling (at that location) will be missing.axis
{0 or ‘index’}
Unused. Parameter needed for compatibility with DataFrame.Returns:
Series
The result of the operation.
117-2、参数
117-2-1、other(必须)标量、Series或DataFrame表示要进行除法运算的值可以是标量、另一个Series或DataFrame如果other是Series或DataFrame则会根据索引进行对齐。
117-2-2、level(可选默认值为None)一个整数或字符串如果other是具有MultiIndex的Series或DataFrame使用该参数可以指定索引的哪个层进行对齐level可以是层的名称或位置(索引值)。
117-2-3、fill_value(可选默认值为None)标量值在对齐过程中如果某个Series的某个索引值在另一个Series或DataFrame中不存在可以通过此参数提供一个填充值以在计算时替换缺失值默认值为None即缺失值会返回NaN。
117-2-4、axis(可选默认值为0)当other是DataFrame时此参数指定沿哪个轴进行操作对于Series通常不需要使用此参数默认值为0(即沿索引方向)。
117-3、功能 用于执行元素级的真除法运算它与Series.div()方法的主要区别在于truediv明确表示执行浮点除法(即除法结果是浮点数)而div方法默认会根据传入的数据类型自动选择整数除法或浮点除法。
117-4、返回值 返回一个新的Series其中包含除法运算的结果如果参与运算的两个对象没有相同的索引结果中缺失的索引会被填充为NaN(若未设置fill_value)。
117-5、说明 无
117-6、用法
117-6-1、数据准备
无
117-6-2、代码示例
# 117、pandas.Series.truediv方法
import pandas as pd
# 创建两个Series
s1 pd.Series([10, 20, 30], index[a, b, c])
s2 pd.Series([1, 2, 3], index[a, b, d])
# 使用truediv方法进行真除法
result s1.truediv(s2, fill_value1)
print(result)
117-6-3、结果输出
# 117、pandas.Series.truediv方法
# a 10.000000
# b 10.000000
# c 30.000000
# d 0.333333
# dtype: float64
118、pandas.Series.floordiv方法
118-1、语法
# 118、pandas.Series.floordiv方法
pandas.Series.floordiv(other, levelNone, fill_valueNone, axis0)
Return Integer division of series and other, element-wise (binary operator floordiv).Equivalent to series // other, but with support to substitute a fill_value for missing data in either one of the inputs.Parameters:
other
Series or scalar value
level
int or name
Broadcast across a level, matching Index values on the passed MultiIndex level.fill_value
None or float value, default None (NaN)
Fill existing missing (NaN) values, and any new element needed for successful Series alignment, with this value before computation. If data in both corresponding Series locations is missing the result of filling (at that location) will be missing.axis
{0 or ‘index’}
Unused. Parameter needed for compatibility with DataFrame.Returns:
Series
The result of the operation.
118-2、参数
118-2-1、other(必须)标量、Series或DataFrame表示要进行地板除法运算的值可以是标量、另一个 Series或DataFrame如果other是Series或DataFrame则会根据索引进行对齐。
118-2-2、level(可选默认值为None)一个整数或字符串如果other是具有MultiIndex的Series或DataFrame使用该参数可以指定索引的哪个层进行对齐level可以是层的名称或位置(索引值)。
118-2-3、fill_value(可选默认值为None)标量值在对齐过程中如果某个Series的某个索引值在另一个Series或DataFrame中不存在可以通过此参数提供一个填充值以在计算时替换缺失值默认值为None即缺失值会返回NaN。
118-2-4、axis(可选默认值为0)一个整数或字符串当other是DataFrame时此参数指定沿哪个轴进行操作对于Series通常不需要使用此参数默认值为0(即沿索引方向)。
118-3、功能 用于执行元素级的地板除法运算该运算的结果是向下取整的整数除法即不管余数是多少结果都会向下舍入到最接近的整数。
118-4、返回值 返回一个新的Series其中包含地板除法运算的结果对于不存在的索引值结果中将填充为NaN(若未设置fill_value)。
118-5、说明 无
118-6、用法
118-6-1、数据准备
无
118-6-2、代码示例
# 118、pandas.Series.floordiv方法
import pandas as pd
# 创建两个Series
s1 pd.Series([10, 20, 30], index[a, b, c])
s2 pd.Series([3, 4, 7], index[a, b, d])
# 使用floordiv方法进行地板除法
result s1.floordiv(s2, fill_value1)
print(result)
118-6-3、结果输出
# 118、pandas.Series.floordiv方法
# a 3.0
# b 5.0
# c 30.0
# d 0.0
# dtype: float64
119、pandas.Series.mod方法
119-1、语法
# 119、pandas.Series.mod方法
pandas.Series.mod(other, levelNone, fill_valueNone, axis0)
Return Modulo of series and other, element-wise (binary operator mod).Equivalent to series % other, but with support to substitute a fill_value for missing data in either one of the inputs.Parameters:
other
Series or scalar value
level
int or name
Broadcast across a level, matching Index values on the passed MultiIndex level.fill_value
None or float value, default None (NaN)
Fill existing missing (NaN) values, and any new element needed for successful Series alignment, with this value before computation. If data in both corresponding Series locations is missing the result of filling (at that location) will be missing.axis
{0 or ‘index’}
Unused. Parameter needed for compatibility with DataFrame.Returns:
Series
The result of the operation.
119-2、参数
119-2-1、other(必须)标量、Series或DataFrame表示要进行模运算的值可以是标量、另一个Series或DataFrame如果other是Series或DataFrame则会根据索引进行对齐。
119-2-2、level(可选默认值为None)一个整数或字符串如果other是具有MultiIndex的Series或DataFrame使用该参数可以指定索引的哪个层进行对齐level可以是层的名称或位置(索引值)。
119-2-3、fill_value(可选默认值为None)标量值在对齐过程中如果某个Series的某个索引值在另一个Series或DataFrame中不存在可以通过此参数提供一个填充值以在计算时替换缺失值默认值为None即缺失值会返回NaN。
119-2-4、axis(可选默认值为0)当other是DataFrame时此参数指定沿哪个轴进行操作对于Series通常不需要使用此参数默认值为0(即沿索引方向)。
119-3、功能 用于执行元素级的模运算(取余运算)该运算将每个元素除以给定的值并返回余数。
119-4、返回值 返回一个新的Series其中包含模运算的结果对于不存在的索引值结果中将填充为NaN(若未设置fill_value)。
119-5、说明
119-5-1、对齐当other是另一个Series或DataFrame时mod()会根据索引进行对齐如果索引不匹配可能会得到NaN(除非使用fill_value填充)。
119-5-2、数据类型模运算的结果将具有与输入Series相同的数据类型。对于整数类型的Series结果也是整数类型对于浮点型结果将是浮点型。
119-6、用法
119-6-1、数据准备
无
119-6-2、代码示例
# 119、pandas.Series.mod方法
import pandas as pd
# 创建两个Series
s1 pd.Series([10, 20, 30], index[a, b, c])
s2 pd.Series([3, 4, 7], index[a, b, d])
# 使用mod方法进行模运算
result s1.mod(s2, fill_value1)
print(result)
119-6-3、结果输出
# 119、pandas.Series.mod方法
# a 1.0
# b 0.0
# c 0.0
# d 1.0
# dtype: float64
120、pandas.Series.pow方法
120-1、语法
# 120、pandas.Series.pow方法
pandas.Series.pow(other, levelNone, fill_valueNone, axis0)
Return Exponential power of series and other, element-wise (binary operator pow).Equivalent to series ** other, but with support to substitute a fill_value for missing data in either one of the inputs.Parameters:
other
Series or scalar value
level
int or name
Broadcast across a level, matching Index values on the passed MultiIndex level.fill_value
None or float value, default None (NaN)
Fill existing missing (NaN) values, and any new element needed for successful Series alignment, with this value before computation. If data in both corresponding Series locations is missing the result of filling (at that location) will be missing.axis
{0 or ‘index’}
Unused. Parameter needed for compatibility with DataFrame.Returns:
Series
The result of the operation.
120-2、参数
120-2-1、other(必须)标量、Series或DataFrame表示幂运算的指数可以是标量(单一的幂值)也可以是另一个Series或DataFrame如果other是Series或DataFrame则会根据索引进行对齐。
120-2-2、level(可选默认值为None)一个整数或字符串如果other是具有MultiIndex的Series或DataFrame使用该参数可以指定索引的哪个层进行对齐level可以是层的名称或位置(索引值)。
120-2-3、fill_value(可选默认值为None)标量值在对齐过程中如果某个Series的某个索引值在另一个Series或DataFrame中不存在可以通过此参数提供一个填充值以在计算时替换缺失值默认值为None即缺失值会返回NaN。
120-2-4、axis(可选默认值为0)当other是DataFrame时此参数指定沿哪个轴进行操作对于Series通常不需要使用此参数默认值为0(即沿索引方向)。
120-3、功能 用于对Series中的每个元素进行幂运算它的功能是将Series的每个元素的值提高到指定的幂次。
120-4、返回值 返回一个新的Series其中包含幂运算的结果对于不存在的索引值结果中将填充为NaN(若未设置fill_value)。
120-5、说明
120-5-1、对齐当other是另一个Series或DataFrame时pow()方法会根据索引进行对齐如果索引不匹配可能会得到NaN(除非使用fill_value填充)。
120-5-2、数据类型幂运算的结果将具有与输入Series相同的数据类型对于整数类型的Series结果也是整数类型对于浮点型结果将是浮点型。
120-6、用法
120-6-1、数据准备
无
120-6-2、代码示例
# 120、pandas.Series.pow方法
import pandas as pd
# 创建两个Series
s1 pd.Series([2, 3, 4], index[a, b, c])
s2 pd.Series([1, 2, 3], index[a, b, d])
# 使用pow方法进行幂运算
result s1.pow(s2, fill_value0)
print(result)
120-6-3、结果输出
# 120、pandas.Series.pow方法
# a 2.0
# b 9.0
# c 1.0
# d 0.0
# dtype: float64
二、推荐阅读
1、Python筑基之旅
2、Python函数之旅
3、Python算法之旅
4、Python魔法之旅
5、博客个人主页