在熊猫时间序列/日期功能中设置频率

加博秀

在 Pandas 中设置时间序列/日期功能的频率时,使用大写或小写字母是否相同

使用 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
耶斯列

在文档中都是价值资本,检查offset-aliases

我尝试小检查它是否相同:

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

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

熊猫:生成时间序列日期时间特征

仅在熊猫系列日期时间索引中重置日期

熊猫:创建具有不同频率的熊猫日期时间序列

重新采样熊猫列日期时间

如何将带有Excel序列日期和常规日期的列转换为熊猫日期时间?

如何在熊猫中创建列日期

将一列日期时间和字符串转换为熊猫中的句点

在基本 R plot() 中显示时间序列日期结构的自动方法

转换序列日期

设置具有两个索引列的时间序列熊猫数据帧的频率

熊猫从时间序列列中获取日期范围

合并/合并熊猫中具有不同频率时间序列索引的两个数据帧?

检查熊猫中细胞的类型日期时间的功能

Google Sheets - 数据表中的序列日期?

熊猫更改列日期格式

根据时间序列中的上一个频率预测下一个日期

在熊猫系列中设置日期时间值时的SettingWithCopyWarning

检查 Pandas DataFrame 中两列日期时间类型的重叠

尽管格式正确,熊猫仍无法推断时间序列的频率?

熊猫时间序列选择单个日期

熊猫按时间序列填充缺少的日期

滞后熊猫在最近日期的时间序列

如何设置熊猫DataFrame的索引以匹配日期时间序列的索引?

熊猫:如何填充多索引时间序列中缺少的期间/日期时间值?

将熊猫中的多个时间序列加入单个日期时间索引的最佳方法?

如何在熊猫时间序列中按日期对日期进行分组?

熊猫时间子集时间序列-特定时间以上的日期

碧玉时间序列日期轴:显示每月滴答声,但每年滴答声标签

使用python从每月使用量生成每日时间序列日期