NumPy Datetimes and Timedeltasを参照してください。基本的には、numpy.datetime64
タイプを使用して数値の範囲を指定することができます。あまり便利datetime64
タイプを持っているnumpyの1.6については、
、あなたは日付時刻を構築するために、適切なリスト内包を使用することができます(また、Creating a range of dates in Python参照):
base = datetime.datetime(2000, 1, 1)
arr = numpy.array([base + datetime.timedelta(hours=i) for i in xrange(24)])
これは
array([2000-01-01 00:00:00, 2000-01-01 01:00:00, 2000-01-01 02:00:00,
2000-01-01 03:00:00, 2000-01-01 04:00:00, 2000-01-01 05:00:00,
2000-01-01 06:00:00, 2000-01-01 07:00:00, 2000-01-01 08:00:00,
2000-01-01 09:00:00, 2000-01-01 10:00:00, 2000-01-01 11:00:00,
2000-01-01 12:00:00, 2000-01-01 13:00:00, 2000-01-01 14:00:00,
2000-01-01 15:00:00, 2000-01-01 16:00:00, 2000-01-01 17:00:00,
2000-01-01 18:00:00, 2000-01-01 19:00:00, 2000-01-01 20:00:00,
2000-01-01 21:00:00, 2000-01-01 22:00:00, 2000-01-01 23:00:00], dtype=object)
も参照してください。http://stackoverflow.com/questions/993358/creating-a-range-of-dates-in-python – nneonneo