[英]set frequency in pandas time series / date functionality
Is it the same using capital or small letters when setting the frequency for Time Series / Date functionality in pandas? 在熊猫中设置时间序列/日期功能的频率时,使用大写或小写字母是否相同?
is it the same using freq='d' or freq='D'? 使用freq ='d'或freq ='D'是否一样?
Offset Aliases
A number of string aliases are given to useful common time series frequencies. We will refer to these aliases as offset aliases.
Alias Description
B business day frequency
C custom business day frequency
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 end frequency
QS quarter start frequency
BQS business quarter start frequency
A, Y year end frequency
BA, BY business year end frequency
AS, YS year start frequency
BAS, BYS 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
In docs are all values capital, check offset-aliases
. 在文档中所有值都是大写的,请检查offset-aliases
。
I try small check if it is same: 我尝试小检查是否相同:
L= ['B','D','W','M','Q','H','T','S']
rng = pd.date_range('2017-04-03', periods=10)
df = pd.DataFrame({'a': range(10)}, index=rng)
print (df)
for x in L:
a = df.resample(x.lower()).ffill()
b = df.resample(x).ffill()
print ((a == b).all())
a True
dtype: bool
a True
dtype: bool
a True
dtype: bool
a True
dtype: bool
a True
dtype: bool
a True
dtype: bool
a True
dtype: bool
a True
dtype: bool
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.