Class name Description
DateOffset Generic offset class, defaults to 1 calendar day
BDay business day (weekday)
CDay 这个可以设置特定的假期
Week one week, optionally anchored on a day of the week
WeekOfMonth the x-th day of the y-th week of each month
LastWeekOfMonth the x-th day of the last week of each month
MonthEnd calendar month end
MonthBegin calendar month begin
BMonthEnd business month end
BMonthBegin business month begin
CBMonthEnd custom business month end
CBMonthBegin custom business month begin
SemiMonthEnd 15th (or other day_of_month) and calendar month end
SemiMonthBegin 15th (or other day_of_month) and calendar month begin
QuarterEnd calendar quarter end
QuarterBegin calendar quarter begin
BQuarterEnd business quarter end
BQuarterBegin business quarter begin
FY5253Quarter retail (aka 52-53 week) quarter
YearEnd calendar year end
YearBegin calendar year begin
BYearEnd business year end
BYearBegin business year begin
FY5253 retail (aka 52-53 week) year
BusinessHour 可以自己设置工作时间
CustomBusinessHour custom business hour
Hour one hour
Minute one minute
Second one second
Milli one millisecond
Micro one microsecond
Nano one nanosecond
from pandas.tseries.offsets import *
d = datetime(2008, 8, 18, 9, 0)
In [106]: d + DateOffset(months=4, days=5)
Out[106]: Timestamp('2008-12-23 09:00:00')
In [107]: d - 5 * BDay()
Out[107]: Timestamp('2008-08-11 09:00:00')In [108]: d + BMonthEnd()
Out[108]: Timestamp('2008-08-29 09:00:00')In [109]: d
Out[109]: datetime.datetime(2008, 8, 18, 9, 0)In [110]: offset = BMonthEnd()In [111]: offset.rollforward(d)
Out[111]: Timestamp('2008-08-29 09:00:00')In [112]: offset.rollback(d)
Out[112]: Timestamp('2008-07-31 09:00:00')

pandas.tseries.offsets相关推荐

  1. python中offset_python pandas tseries.offsets.DateOffset用法及代码示例

    用于日期范围的标准日期增量类型. 就您传入的关键字args而言,其工作方式与relativedelta完全相同,不建议使用关键字n-最好在使用的关键字中指定n,但无论它是否适合您. DateOffse ...

  2. python offset函数_Python Pandas tseries.offsets.BusinessHour.copy用法及代码示例

    Dateoffsets是用于Pandas中日期范围的标准日期增量.就我们传入的关键字args而言,它的工作方式与relativedelta完全相同.DateOffets的工作方式如下,每个偏移量指定一 ...

  3. pandas.tseries.offset, 获取季度,月度第一天(最后一天)

    Class name Description DateOffset Generic offset class, defaults to 1 calendar day BDay business day ...

  4. ModuleNotFoundError: No module named ‘pandas.tseries‘

    from pandas.tseries import offsets ModuleNotFoundError: No module named 'pandas.tseries' 1 检查是不是没有装m ...

  5. 使用python中TsTables 软件包追加写入数据出现“pandas.tseries has no attribute‘index‘”的问题

    球球今天下午在用jupyter使用TsTables 软件包追加写入数据的时候用了一行代码:%time ts.append(df),可是直接报错pandas.tseries has no attribu ...

  6. module “pandas.tseries“ has no attribute “index“; module “pandas.core“ has no attribute “index“

    我是天才! 想实现一个ARIMAX的模型还真难...网上参考资料少之又少,就连运行官网提供的代码也会出错,心力交瘁/(ㄒ--ㄒ)/~~ 好在折腾半天,终于有解,忍不住夸自己一句"小张真棒!& ...

  7. Error - 使用statsmodels报错ModuleNotFoundError: No module named 'pandas.tseries.tools'

    pandas好像在某次更新后就不这么使用tools. 问题在statsmodel还是老版本 pip install statsmodels --upgrade 然后更新太慢 read time out ...

  8. pandas笔记:tseries.offset

    进行date的偏移 1 各种offset 1.1 DateOffset 1.1.1 基本使用方法 class pandas.tseries.offsets.DateOffset n 偏移量表示的时间段 ...

  9. Python数据分析学习笔记之Pandas入门

    pandas(Python data analysis)是一个Python数据分析的开源库. pandas两种数据结构:DataFrame和Series 安装:pandas依赖于NumPy,pytho ...

最新文章

  1. 什么是self-attention、Multi-Head Attention、Transformer
  2. python【力扣LeetCode算法题库】面试题 08.11- 硬币
  3. python整理excel数据-利用python整理需要的excel报表(上)
  4. 回复:lerit的关于对象中字段的初始化问题
  5. AngularJs的理解
  6. linux 安装mysql5.7.12_Linux系统上安装mysql5.7.12
  7. 大家可以在十分钟内入睡吗?有什么快速入睡的方法吗?
  8. 都说苹果秋季发布会像一杯白开水,那么...
  9. SNMP弱口令导致的网络入侵
  10. matlab求均值和方差偏度峰度,均值、标准差、偏度、峰度的绘制
  11. Command ‘docker‘ not found, but can be installed with:
  12. linux 内存碎片信息查看
  13. strtolower() 把字符串转换为小写字母
  14. Python中文社区开源项目计划:ImagePy
  15. 判断当前页面是否在微信内置浏览器中打开
  16. ios 渐变透明背景_PS教程:通道抠图技巧换背景案例
  17. STM32驱动陀螺仪MPU6050的应用实例
  18. 初学画画怎么画线稿?学画线稿的方法有哪些?
  19. 自媒体人必备神器,200w+自媒体人都在用
  20. 10种常见的HTML标签错误写法

热门文章

  1. Python使用折线图、柱状图、热力图比较不同班级相同学号学生的成绩
  2. 使用Python进行任务调度(进阶篇)
  3. java报错信息怎么看_AE-E3D插件无效或提示OPENGL E3D Debug等错误报错信息怎么办?...
  4. C++ 面向对象程序三大特性之 继承
  5. java实现订单物品计算佣金,java三角形、NextDay、佣金问题代码
  6. linux下载python 没有iedl_linux 安装python
  7. 96.不同的二叉搜索树(JavaScript)
  8. 内蒙古全国计算机考试注意事项,2018年3月内蒙古自治区呼和浩特计算机等级考试注意事项...
  9. win10文件同步到服务器失败,win10系统同步时间同步失败的解决方法
  10. 简单选择排序_Python3三种简单排序(冒泡、插入、选择)的比较