Skip to content

Instantly share code, notes, and snippets.

@HirofumiYashima
Last active August 29, 2015 14:15
Show Gist options
  • Save HirofumiYashima/71a3436ded56e3a15626 to your computer and use it in GitHub Desktop.
Save HirofumiYashima/71a3436ded56e3a15626 to your computer and use it in GitHub Desktop.
Python で 日時データ・オブジェクトを得るには、Pandas の pd.date_range() で作成した後で型変換すると簡単 ref: http://qiita.com/HirofumiYashima/items/883368095d45590de11a
1. periods : 取得したい要素の数は6(日間)なので、6を指定します
2. freq : 1日置きの日次データが欲しいため、"D"を指定します(Day)
['2015-02-01', '2015-02-02', '2015-02-03', '2015-02-04', '2015-02-05', '2015-02-06']
2015-02-01 00:00:00
2015-02-02 00:00:00
2015-02-03 00:00:00
2015-02-04 00:00:00
2015-02-05 00:00:00
2015-02-01
2015-02-02
2015-02-03
2015-02-04
2015-02-05
2015-02-01
2015-02-02
2015-02-03
2015-02-04
2015-02-05
[x for x in str_date_list]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment