Black Lives Matter. Please consider donating to Black Girls Code today.

Problem: All scatter points shifts on 5 to left

My dates starts from 1 August 2018. But on graph it starts from 31 August 2018 19:00. All points are correct except this shift. It appears in all my project. Im using PyCharm. Details here stackoverflow link

It exist and without dash on plotly only.

Could you share a screenshot?

Untitled
I found a trick.
If cast python datetime to string it works.
Before trick:
date.append(datetime.datetime(2018,8,1) + datetime.timedelta(hours=i))
After trick:
date.append(str(datetime.datetime(2018,8,1) + datetime.timedelta(hours=i)))

Will be very appreciate if someone explain what goes wrong.

Hm, it might be a timezone issue

Yes, my timezone exactly UTC+5. Can you show me easy way to fix it?

Update: find that tzinfo=pytz.UTC works.
If i have date in string format(from file),
Is it best option?

date = datetime.datetime.strptime(date_string, '%d.%m.%Y %H:%M:%S')
date = datetime.datetime(date.year,date.month,date.day,date.hour,date.minute,
                  tzinfo=pytz.UTC)
1 Like