当前位置:网站首页>date_ Range creation date range freq parameter value table and creation example
date_ Range creation date range freq parameter value table and creation example
2022-06-26 04:50:00 【I am a little monster】
>>> r=pd.date_range(start='1999-12-01',end='1999-12-31')
>>> print(r)
DatetimeIndex(['1999-12-01', '1999-12-02', '1999-12-03', '1999-12-04',
'1999-12-05', '1999-12-06', '1999-12-07', '1999-12-08',
'1999-12-09', '1999-12-10', '1999-12-11', '1999-12-12',
'1999-12-13', '1999-12-14', '1999-12-15', '1999-12-16',
'1999-12-17', '1999-12-18', '1999-12-19', '1999-12-20',
'1999-12-21', '1999-12-22', '1999-12-23', '1999-12-24',
'1999-12-25', '1999-12-26', '1999-12-27', '1999-12-28',
'1999-12-29', '1999-12-30', '1999-12-31'],
dtype='datetime64[ns]', freq='D')>>> r=pd.date_range(start='1999-12-01',end='1999-12-31',freq='B')
>>> print(r)
DatetimeIndex(['1999-12-01', '1999-12-02', '1999-12-03', '1999-12-06',
'1999-12-07', '1999-12-08', '1999-12-09', '1999-12-10',
'1999-12-13', '1999-12-14', '1999-12-15', '1999-12-16',
'1999-12-17', '1999-12-20', '1999-12-21', '1999-12-22',
'1999-12-23', '1999-12-24', '1999-12-27', '1999-12-28',
'1999-12-29', '1999-12-30', '1999-12-31'],
dtype='datetime64[ns]', freq='B')
>>> r=pd.date_range(start='1999-12-01',end='1999-12-31',freq='BM')
>>> print(r)
DatetimeIndex(['1999-12-31'], dtype='datetime64[ns]', freq='BM'
>>> r=pd.date_range(start='1999-1-01',end='1999-12-31',freq='BQS')
>>> print(r)
DatetimeIndex(['1999-01-01', '1999-04-01', '1999-07-01', '1999-10-01'], dtype='datetime64[ns]', freq='BQS-JAN')Offset parameter
date_range There is a parameter in the freq, Used to select from the range you specify , You can choose working days (B)、 At the beginning of (MS)、 Month end working day (BM)、 The working day at the beginning of the quarter (BQS) etc. .
| Alias | explain |
| B | Working day |
| C | Custom weekdays ( experiment ) |
| D | Calendar day |
| W | Once a week |
| M | end of the month |
| SM | Mid month and end of month ( The 15th day and the end of each month ) |
| BM | Month end working day |
| CBM | Customize month end workdays |
| MS | At the beginning of |
| SMS | The beginning of the month and the middle of the month ( The first and fifteenth days of each month ) |
| BMS | Working day at the beginning of the month |
| CBMS | Customize the working day at the beginning of the month |
| Q | Quarter end |
| BQ | Quarter end business day |
| QS | Beginning of quarter |
| BQS | The working day at the beginning of the quarter |
| A | end of the year |
| BA | Working days at the end of the year |
| AS | Beginning of the year |
| BAS | Working days at the beginning of the year |
| BH | working hours |
| H | Hours |
| T | minute |
| S | second |
| L | millisecond |
| U | Microsecond |
| N | nanosecond |
边栏推荐
猜你喜欢

Yapi cross domain request plug-in installation

Thinkphp6 implements a simple lottery system

为什么许多shopify独立站卖家都在用聊天机器人?一分钟读懂行业秘密!

【Latex】错误类型总结(持更)

Genius makers: lone Rangers, technology giants and AI | ten years of the rise of in-depth learning

Yolov5 super parameter setting and data enhancement analysis

torchvision_transform(图像增强)

Dbeaver installation and configuration of offline driver

Multipass中文文档-远程使用Multipass

Rdkit chemical formula molecular formula search
随机推荐
2.9 learning summary
YOLOV5训练结果的解释
Text horizontal alignment attribute text align and element vertical alignment attribute vertical align
Multipass中文文档-移除实例
digital image processing
Hash problem
Install Damon database
1.20 learning summary
YOLOv5-6.0的一些参数设置和特征图可视化
Create alicloud test instances
Method of saving pictures in wechat applet
1.12 learning summary
numpy 通用函数
Multipass中文文档-使用Multipass服务授权客户端
ROS notes (07) - Implementation of client and server
PHP small factory moves bricks for three years - interview series - my programming life
Multipass中文文档-与实例共享数据
Tips for using idea
LISP programming language
Why do many Shopify independent station sellers use chat robots? Read industry secrets in one minute!