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

公司建设网站记什么费用镇江网页设计

公司建设网站记什么费用,镇江网页设计,做网站需服务器吗,网络营销的定义是什么?Pandas2.2 Series Computations descriptive stats 方法描述Series.align(other[, join, axis, level, …])用于将两个 Series 对齐,使其具有相同的索引Series.case_when(caselist)用于根据条件列表对 Series 中的元素进行条件判断并返回相应的值Series.drop([lab…

Pandas2.2 Series

Computations descriptive stats

方法描述
Series.align(other[, join, axis, level, …])用于将两个 Series 对齐,使其具有相同的索引
Series.case_when(caselist)用于根据条件列表对 Series 中的元素进行条件判断并返回相应的值
Series.drop([labels, axis, index, columns, …])用于从 Series 中删除指定的行或列(对于 Series 来说,通常是删除行)
Series.droplevel(level[, axis])用于从多层索引(MultiIndex)的 Series 中删除指定的索引层级
Series.drop_duplicates(*[, keep, inplace, …])用于从 Series 中删除重复的值
Series.duplicated([keep])用于检测 Series 中的重复值
Series.equals(other)用于比较两个 Series 对象是否完全相等的方法
Series.first(offset)用于根据日期偏移量(offset)选择 Series 中时间序列数据的初始部分
Series.head([n])用于返回 Series 的前 n 个元素
Series.idxmax([axis, skipna])用于返回 Series 中最大值的索引
Series.idxmin([axis, skipna])用于返回 Series 中最小值的索引
Series.isin(values)用于检查 Series 中的每个元素是否存在于给定的值集合 values
Series.last(offset)用于根据日期偏移量(offset)选择 Series 中时间序列数据的末尾部分

pandas.Series.last

pandas.Series.last(offset) 是 Pandas 库中的一个方法,用于根据日期偏移量(offset)选择 Series 中时间序列数据的末尾部分。它与 first() 方法类似,但方向相反,能够快速提取指定时间范围内的数据。


方法签名
Series.last(offset)

参数详解
  1. offset:
    • 一个表示时间范围的字符串或 DateOffset 对象。
    • 例如:'3D' 表示 3 天,'1M' 表示 1 个月,'2Y' 表示 2 年。
    • 支持的偏移量单位包括:
      • D:天
      • M:月
      • Y:年
      • H:小时
      • Tmin:分钟
      • S:秒
    • 默认值:无(必须提供)。

返回值
  • 返回一个新的 Series,包含从结束时间向前推算指定偏移量范围内的数据。

示例及结果
示例 1:按天偏移量选择数据
import pandas as pd# 创建一个时间序列 Series
dates = pd.date_range('2023-10-01', periods=10, freq='D')
s = pd.Series(range(10), index=dates)print("原 Series:")
print(s)# 选择最后 3 天的数据
result = s.last('3D')print("\n最后 3 天的数据:")
print(result)

结果:

原 Series:
2023-10-01    0
2023-10-02    1
2023-10-03    2
2023-10-04    3
2023-10-05    4
2023-10-06    5
2023-10-07    6
2023-10-08    7
2023-10-09    8
2023-10-10    9
Freq: D, dtype: int64最后 3 天的数据:
2023-10-08    7
2023-10-09    8
2023-10-10    9
Freq: D, dtype: int64

解释:

  • last('3D') 选择了从结束时间 2023-10-10 向前推算的 3 天数据。

示例 2:按月偏移量选择数据
import pandas as pd# 创建一个时间序列 Series
dates = pd.date_range('2023-01-01', periods=12, freq='M')
s = pd.Series(range(12), index=dates)print("原 Series:")
print(s)# 选择最后 2 个月的数据
result = s.last('2M')print("\n最后 2 个月的数据:")
print(result)

结果:

原 Series:
2023-01-31     0
2023-02-28     1
2023-03-31     2
2023-04-30     3
2023-05-31     4
2023-06-30     5
2023-07-31     6
2023-08-31     7
2023-09-30     8
2023-10-31     9
2023-11-30    10
2023-12-31    11
Freq: ME, dtype: int64最后 2 个月的数据:
2023-11-30    10
2023-12-31    11
Freq: ME, dtype: int64

解释:

  • last('2M') 选择了从结束时间 2023-12-31 向前推算的 2 个月数据。

示例 3:按小时偏移量选择数据
import pandas as pd# 创建一个时间序列 Series
dates = pd.date_range('2023-10-01 00:00', periods=24, freq='H')
s = pd.Series(range(24), index=dates)print("原 Series:")
print(s)# 选择最后 6 小时的数据
result = s.last('6H')print("\n最后 6 小时的数据:")
print(result)

结果:

原 Series:
2023-10-01 00:00:00     0
2023-10-01 01:00:00     1
2023-10-01 02:00:00     2
2023-10-01 03:00:00     3
2023-10-01 04:00:00     4
2023-10-01 05:00:00     5
2023-10-01 06:00:00     6
2023-10-01 07:00:00     7
2023-10-01 08:00:00     8
2023-10-01 09:00:00     9
2023-10-01 10:00:00    10
2023-10-01 11:00:00    11
2023-10-01 12:00:00    12
2023-10-01 13:00:00    13
2023-10-01 14:00:00    14
2023-10-01 15:00:00    15
2023-10-01 16:00:00    16
2023-10-01 17:00:00    17
2023-10-01 18:00:00    18
2023-10-01 19:00:00    19
2023-10-01 20:00:00    20
2023-10-01 21:00:00    21
2023-10-01 22:00:00    22
2023-10-01 23:00:00    23
Freq: h, dtype: int64最后 6 小时的数据:
2023-10-01 18:00:00    18
2023-10-01 19:00:00    19
2023-10-01 20:00:00    20
2023-10-01 21:00:00    21
2023-10-01 22:00:00    22
2023-10-01 23:00:00    23
Freq: h, dtype: int64

解释:

  • last('6H') 选择了从结束时间 2023-10-01 23:00:00 向前推算的 6 小时数据。

示例 4:按年偏移量选择数据
import pandas as pd# 创建一个时间序列 Series
dates = pd.date_range('2020-01-01', periods=5, freq='Y')
s = pd.Series(range(5), index=dates)print("原 Series:")
print(s)# 选择最后 2 年的数据
result = s.last('2Y')print("\n最后 2 年的数据:")
print(result)

结果:

原 Series:
2020-12-31    0
2021-12-31    1
2022-12-31    2
2023-12-31    3
2024-12-31    4
Freq: YE-DEC, dtype: int64最后 2 年的数据:
2023-12-31    3
2024-12-31    4
Freq: YE-DEC, dtype: int64

解释:

  • last('2Y') 选择了从结束时间 2024-12-31 向前推算的 2 年数据。

注意事项
  1. last() 方法仅适用于具有 DatetimeIndex 的 Series。
  2. 如果索引不是时间序列类型,会抛出 TypeError
  3. offset 参数必须是一个有效的日期偏移量字符串或 DateOffset 对象。

通过 last() 方法,可以方便地从时间序列数据中提取指定时间范围内的末尾数据,适用于快速分析和处理时间序列数据。

http://www.dtcms.com/wzjs/171758.html

相关文章:

  • 做海外网站深圳网站seo哪家快
  • 淘宝网站建设的详细策划百度搜索引擎优化的方法
  • 云南网站seo外包鱼头seo软件
  • 什么公司做网站最好营销网店推广的软文
  • wordpress同ip弹一次广告seo关键词优化技巧
  • 一流门户网站建设seo的形式有哪些
  • 那个网站做稻草交易推广拉新app哪几个靠谱
  • 360网站做推广西安网络推广优化培训
  • 北京营销型网站公司seo自学教程seo免费教程
  • 南宁网站建设索q.479185700日照网络推广公司
  • 网站做多个单页链接网络营销推广方案步骤
  • 做网站必备模板建站公司
  • 如何建设备案网站视频教程今日微博热搜榜前十名
  • php学什么可以做网站百度免费安装
  • asp网站免费电商平台怎么推广
  • 设计找图网站制作一个网站的流程有哪些
  • 张家口建设网站长沙靠谱关键词优化服务
  • 沂南建设局网站百度提交入口网址
  • 施工企业如何获取竞争优势seo优化的优点
  • 怎么做直播网站刷弹幕推广一次多少钱
  • 宿舍网站建设目的超云seo优化
  • anaconda可以做网站吗深圳搜索优化排名
  • 服务网站建设企业大连最好的做网站的公司
  • 六安品牌网站建设电话昆明装饰企业网络推广
  • 服装公司网站设计推销产品的软文500字
  • 怎么在中国移动做网站备案百度竞价账户
  • 安徽省工程建设监管和信用管理网网站优化关键词排名公司
  • 余姚市住房和城乡建设局网站福州seo优化排名推广
  • 摄影网页模板河北seo技术
  • 微信公众号的微网站怎么做的seo标题优化关键词