LoginSignup
0
0

More than 1 year has passed since last update.

pandas 時系列データで使用できる期間を指定するaliasの一覧

Posted at

はじめに

pandasのリファレンスの読み方が最初わかりにくかったので個人的なメモです。

Pythonでデータを直感的に操作するためのライブラリpandasを学び始めました。
pandasのコードを読んでいると時間指定するところで、文字でいろいろ指定されているのがわかりました。

# 年間の平均値の数値の推移を取得
data.resample('A').mean()

このように指定できる文字列いろいろあるようです。

時系列データの操作についての詳細はTime series / date functionality — pandas 1.4.2 documentationに記載されています。ここにたどり着くのに少し手間取りました。

頻度のalias一覧

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

参考

Time series / date functionality — pandas 1.4.2 documentation

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0