http://pandas.pydata.org/pandas-docs/stable/generated/pandas.date_range.html#pandas.date_range
pandas.date_range(start=None, end=None, periods=None, freq='D', tz=None, normalize=False, name=None, closed=None, **kwargs)
参数
参数 | 描述 |
---|---|
start : string or datetime-like, default None | |
end : string or datetime-like, default None | |
periods : integer or None, default None | 生成时间段的size,要指定开始时间或者结束时间 |
freq : string or DateOffset, default ‘D’ (calendar daily) | 生成时间的间隔,默认是天 |
tz : string or None | Time zone name for returning localized DatetimeIndex, for example Asia/Hong_Kong |
normalize : bool, default False | Normalize start/end dates to midnight before generating date range |
name : str, default None | Name of the resulting index |
closed : string or None, default None | Make the interval closed with respect to the given frequency to the ‘left’, ‘right’, or both sides (None) |
freq参数选项
简称 | Description | 描述 |
---|---|---|
B | business day frequency | 工作日 |
C | custom business day frequency (experimental) | |
D | calendar day frequency | 日历日 |
W | weekly frequency | |
M | month end frequency | |
SM | semi-month end frequency (15th and end of month) | |
BM | business month end frequency | |
CBM | custom business month end frequency | |
MS | month start frequency | |
SMS | semi-month start frequency (1st and 15th) | |
BMS | business month start frequency | |
CBMS | custom business month start frequency | |
Q | quarter end frequency | |
BQ | business quarter endfrequency | |
QS | quarter start frequency | |
BQS | business quarter start frequency | |
A | year end frequency | |
BA | business year end frequency | |
AS | year start frequency | |
BAS | business year start frequency | |
BH | business hour frequency | |
H | hourly frequency | |
T, min | minutely frequency | |
S | secondly frequency | |
L, ms | milliseconds | |
U, us | microseconds | |
N | nanoseconds |
返回值
rng : DatetimeIndex
其他
bdate_range([start, end, periods, freq, tz, …])工作日序列生成快捷函数
period_range([start, end, periods, freq, name])范围序列生成快捷函数