当前位置: 首页 > news >正文

做网站尽在美橙互联百度网盘私人资源链接

做网站尽在美橙互联,百度网盘私人资源链接,幼儿园网站的建设需求分析,张家界网站建设app目录 一、用法精讲 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, level=None, fill_value=None, axis=0)
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_value=0)
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, level=None, fill_value=None, axis=0)
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_value=1)  
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, level=None, fill_value=None, axis=0)
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_value=1)
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, level=None, fill_value=None, axis=0)
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_value=1)
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, level=None, fill_value=None, axis=0)
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_value=0)
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、博客个人主页
http://www.zhongyajixie.com/news/63579.html

相关文章:

  • 一般公司网站是什么设计师做最新军事新闻 今日 最新消息
  • 外贸网站违反谷歌规则百度应用市场官网
  • 微信小程序客户管理系统南京seo优化
  • 益阳网站建设企业合肥推广外包公司
  • 建设通网站是政府的么厦门seo新站策划
  • wordpress 挖矿脚本牡丹江seo
  • 网站名称与主体性质不符谷歌关键词推广怎么做
  • 中国建设银行公积金网缴网站广州网站建设技术外包
  • 网站后台报表统计系统必应搜索推广
  • 做网站是用源码还是模版seo 重庆
  • 企业不想做网站的原因手机游戏性能优化软件
  • 腾讯24小时人工热线seo排名优化是什么
  • 做动漫主题的网站推广赚钱的微信小程序
  • 提供免费网站建设国外网站怎么推广
  • 汉化wordpress插件app优化建议
  • 老师问我做网站用到什么创新技术网站排名优化服务公司
  • 广州一共13个区深圳seo外包
  • 肇庆网站关键词优化seo图片优化
  • 怎样设计手机网站建设html底部友情链接代码
  • 怎样做博客网站网络推广引流方式
  • 招商加盟网站大全seo社区
  • wordpress集成ckplayer谷歌seo优化公司
  • 南京做网站品牌镇江网站关键字优化
  • 哪些是用vue做的网站艾滋病多久能检查出来
  • 孝感网站建设目前较好的crm系统
  • linux 网站服务器搭建网站备案信息查询
  • 网站seo优化加推广郑州seo推广外包
  • 最后的目的是什么网站页面优化内容包括哪些
  • 做网站要学习什么搜索引擎优化服务公司哪家好
  • 千助做网站怎么样360广告推广平台