Python pandas date_range 生成时间序列

网友投稿 893 2022-05-30

环境信息

ModelArts

Notebook - pytorch1.4-cuda10.1-cudnn7-ubuntu18.04

JupyterLab - Notebook - Conda-python3

Pandas date_range 生成时间序列

import pandas as pd # 生成时间序列 pd.date_range('20210715',periods=30) DatetimeIndex(['2021-07-15', '2021-07-16', '2021-07-17', '2021-07-18', '2021-07-19', '2021-07-20', '2021-07-21', '2021-07-22', '2021-07-23', '2021-07-24', '2021-07-25', '2021-07-26', '2021-07-27', '2021-07-28', '2021-07-29', '2021-07-30', '2021-07-31', '2021-08-01', '2021-08-02', '2021-08-03', '2021-08-04', '2021-08-05', '2021-08-06', '2021-08-07', '2021-08-08', '2021-08-09', '2021-08-10', '2021-08-11', '2021-08-12', '2021-08-13'], dtype='datetime64[ns]', freq='D')

help

help(pd.date_range) Help on function date_range in module pandas.core.indexes.datetimes: date_range(start=None, end=None, periods=None, freq=None, tz=None, normalize=False, name=None, closed=None, **kwargs) -> pandas.core.indexes.datetimes.DatetimeIndex Return a fixed frequency DatetimeIndex. Parameters ---------- start : str or datetime-like, optional Left bound for generating dates. end : str or datetime-like, optional Right bound for generating dates. periods : int, optional Number of periods to generate. freq : str or DateOffset, default 'D' Frequency strings can have multiples, e.g. '5H'. See :ref:`here ` for a list of frequency aliases. tz : str or tzinfo, optional Time zone name for returning localized DatetimeIndex, for example 'Asia/Hong_Kong'. By default, the resulting DatetimeIndex is timezone-naive. normalize : bool, default False Normalize start/end dates to midnight before generating date range. name : str, default None Name of the resulting DatetimeIndex. closed : {None, 'left', 'right'}, optional Make the interval closed with respect to the given frequency to the 'left', 'right', or both sides (None, the default). **kwargs For compatibility. Has no effect on the result. Returns ------- rng : DatetimeIndex ......

相关链接

Python入门篇

Python进阶篇

Python应用篇

帮助文档-AI开发平台ModelArts

【生长吧!Python】有奖征文火热进行中

备注

Python pandas date_range 生成时间序列

欢迎各位同学一起来交流学习心得^_^

在线课程、沙箱实验、认证、论坛和直播,其中包含了许多优质的内容,推荐了解与学习。

AI开发平台ModelArts Python

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:uni-app的scroll-view下拉刷新加载状态关闭不了的问题
下一篇:这是一个国内只有寥寥数人懂得的云计算技术
相关文章