修复pandas.date_range格式

时间:2019-01-14 15:06:44

标签: python-3.x date indexing date-range

我要使用pandas.date_range函数,如下所示:

import pandas as pd  

start_date = '01/08/2017 23:30'

end_date = '02/08/2017 23:30'

dates = pd.date_range(start_date, end_date, freq='min')

我希望August (08)是我约会的月份,但是date_range使用January (01)February (02)作为月份。

print dates

DatetimeIndex(['2017-01-08 23:30:00', '2017-01-08 23:31:00',
           '2017-01-08 23:32:00', '2017-01-08 23:33:00',
           '2017-01-08 23:34:00', '2017-01-08 23:35:00',
           '2017-01-08 23:36:00', '2017-01-08 23:37:00',
           '2017-01-08 23:38:00', '2017-01-08 23:39:00',

           ...

           '2017-02-08 23:21:00', '2017-02-08 23:22:00',
           '2017-02-08 23:23:00', '2017-02-08 23:24:00',
           '2017-02-08 23:25:00', '2017-02-08 23:26:00',
           '2017-02-08 23:27:00', '2017-02-08 23:28:00',
           '2017-02-08 23:29:00', '2017-02-08 23:30:00'],
          dtype='datetime64[ns]', length=44641, freq='T')

如何解决此问题?

0 个答案:

没有答案