Python pandas date_range 生成时间序列
【摘要】 环境信息ModelArtsNotebook - pytorch1.4-cuda10.1-cudnn7-ubuntu18.04JupyterLab - Notebook - Conda-python3 pandas date_range 生成时间序列import pandas as pd# 生成时间序列pd.date_range('20210715',periods=30)Datetime...
环境信息
- ModelArts
- Notebook - pytorch1.4-cuda10.1-cudnn7-ubuntu18.04
- JupyterLab - Notebook - Conda-python3
- Notebook - pytorch1.4-cuda10.1-cudnn7-ubuntu18.04
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 <timeseries.offset_aliases>` 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
......
相关链接
备注
- 欢迎各位同学一起来交流学习心得^_^
- 在线课程、沙箱实验、认证、论坛和直播,其中包含了许多优质的内容,推荐了解与学习。
【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)