不断收到AttributeError:“ UTC”对象没有属性“ offset”

时间:2020-05-12 11:31:04

标签: python pandas python-datetime

我有两个日期start_dateend_date,稍后将在pandas.date_range()中使用。

start_date = datetime.datetime(2014, 2, 8, 0, 0, tzinfo=rfc3339.UTC_TZ)
end_date = datetime.datetime(2016, 1, 29, 0, 0, tzinfo=rfc3339.UTC_TZ)
pd.date_range(start_date, end_date)

这两个日期都有偏移量,当我在pd.date_range()中使用它们时,会不断出现类似以下错误:

AttributeError: 'str' object has no attribute 'offset'
Exception AttributeError: "'str' object has no attribute 'offset'" in 'pandas._libs.tslibs.conversion.tz_convert_single' ignored
*** AttributeError: 'UTC' object has no attribute 'offset'

有人可以帮助我如何转换这些日期,以便可以在pd.data_range()中使用它们吗?

0 个答案:

没有答案