python - How do I get .to_datetime() to stop offsetting by UTC in string -
this question has answer here:
- how read datetime timezone in pandas 1 answer
i'm converting timestamp given string .csv file. in format:
2016-06-06t09:30:00.000856632-04:00
when use .to_datetime()
convert date object, offsets utc time. in example, 9:30am becomes 1:30pm:
2016-06-06 13:30:00.000856632
i read documentation function , thought setting utc = false parameter fix offsets time different amount.
the string has -4 hours offset. remove before conversion:
>>> pd.to_datetime("2016-06-06t09:30:00.000856632-04:00"[:-6]) timestamp('2016-06-06 09:30:00.000856632')
Comments
Post a Comment