小编Mor*_*adi的帖子

本地化熊猫日期时间索引时出现 NonExistentTimeError

我正在使用dataframe.index = dataframe.index.tz_localize('Iran')本地化我的 Pandas 数据帧日期时间索引。问题是 Django 上升了一个NonExistentTimeError.

Djangosetting.py时区设置为我的本地时区。TIME_ZONE = 'Iran'

数据框:

2014-08-11 12:00:00+00:00  3076.366
2014-08-11 11:45:00+00:00  3076.367
2014-08-11 11:30:00+00:00  3076.385
2014-08-11 11:15:00+00:00  3076.417
2014-08-11 11:00:00+00:00  3076.466
2014-08-11 10:45:00+00:00  3076.532
2014-08-11 10:30:00+00:00  3076.611
2014-08-11 10:15:00+00:00  3076.702
2014-08-11 10:00:00+00:00  3076.802
2014-08-11 09:45:00+00:00  3076.910

In [112]:dataframe.index.tzinfo
In [113]:<StaticTzInfo 'GMT'>
Run Code Online (Sandbox Code Playgroud)

[10 行 x 1 列]

python django timezone pandas

5
推荐指数
1
解决办法
3184
查看次数

标签 统计

django ×1

pandas ×1

python ×1

timezone ×1