Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/342.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何根据我想要的日期创建间隔为一年的时间戳数组?_Python_Pandas_Timestamp - Fatal编程技术网

Python 如何根据我想要的日期创建间隔为一年的时间戳数组?

Python 如何根据我想要的日期创建间隔为一年的时间戳数组?,python,pandas,timestamp,Python,Pandas,Timestamp,我想根据我想与熊猫相处的日期,制作一个间隔一年的时间戳数组。 例如)['1994-08-17 00:00:00+09:00','1995-08-17 00:00:00+09:00', “1996-08-17 00:00:00+09:00”,“1997-08-17 00:00:00+09:00” 但我不能去。请帮帮我。 下面是我制作的一些数组 1) freq='A-AUG' 日期时间索引(['1994-08-31 00:00:00+09:00','1995-08-31 00:00:00+09:00

我想根据我想与熊猫相处的日期,制作一个间隔一年的时间戳数组。

例如)['1994-08-17 00:00:00+09:00','1995-08-17 00:00:00+09:00', “1996-08-17 00:00:00+09:00”,“1997-08-17 00:00:00+09:00”

但我不能去。请帮帮我。

下面是我制作的一些数组

1) freq='A-AUG'

日期时间索引(['1994-08-31 00:00:00+09:00','1995-08-31 00:00:00+09:00', '1996-08-31 00:00:00+09:00', '1997-08-31 00:00:00+09:00', '1998-08-31 00:00:00+09:00', '1999-08-31 00:00:00+09:00', '2000-08-31 00:00:00+09:00', '2001-08-31 00:00:00+09:00', '2002-08-31 00:00:00+09:00', '2003-08-31 00:00:00+09:00', '2004-08-31 00:00:00+09:00', '2005-08-31 00:00:00+09:00', '2006-08-31 00:00:00+09:00', '2007-08-31 00:00:00+09:00', '2008-08-31 00:00:00+09:00', '2009-08-31 00:00:00+09:00', '2010-08-31 00:00:00+09:00', '2011-08-31 00:00:00+09:00', '2012-08-31 00:00:00+09:00', '2013-08-31 00:00:00+09:00', '2014-08-31 00:00:00+09:00', '2015-08-31 00:00:00+09:00', '2016-08-31 00:00:00+09:00', '2017-08-31 00:00:00+09:00', '2018-08-31 00:00:00+09:00', '2019-08-31 00:00:00+09:00'], dtype='datetime64[ns,亚洲/首尔]',freq='A-AUG')

2) freq='A'

日期时间索引(['1994-12-31 00:00:00+09:00','1995-12-31 00:00:00+09:00', '1996-12-31 00:00:00+09:00', '1997-12-31 00:00:00+09:00', '1998-12-31 00:00:00+09:00', '1999-12-31 00:00:00+09:00', '2000-12-31 00:00:00+09:00', '2001-12-31 00:00:00+09:00', '2002-12-31 00:00:00+09:00', '2003-12-31 00:00:00+09:00', '2004-12-31 00:00:00+09:00', '2005-12-31 00:00:00+09:00', '2006-12-31 00:00:00+09:00', '2007-12-31 00:00:00+09:00', '2008-12-31 00:00:00+09:00', '2009-12-31 00:00:00+09:00', '2010-12-31 00:00:00+09:00', '2011-12-31 00:00:00+09:00', '2012-12-31 00:00:00+09:00', '2013-12-31 00:00:00+09:00', '2014-12-31 00:00:00+09:00', '2015-12-31 00:00:00+09:00', '2016-12-31 00:00:00+09:00', '2017-12-31 00:00:00+09:00', '2018-12-31 00:00:00+09:00', '2019-12-31 00:00:00+09:00'], dtype='datetime64[ns,亚洲/首尔]',freq='A-DEC')

sw_y=pd.date_范围(start='1994-08-17',
周期=26,
freq='A-AUG',
(亚洲/汉城)

您可以设置之后的日期:

import pandas as pd
sw_y = pd.date_range(start='1994-08-17',
                      periods=26,
                      freq='A-AUG',
                      tz='Asia/Seoul')
sw_y = sw_y + pd.DateOffset(day=17)

如果答案解决了你的问题,你可以接受。