'Working with time-series data that is in LST timezone, WITHOUT daylight savings time. How can I convert this to PST8PDT?
I am working in Pandas with NOAA hourly meteorological data, which is recorded in Local Standard Time (without regard for daylight savings time). How can I convert this to LST with Daylight Savings?
So far I have tried adding an 8 hour offset to the tz naive datetime data, localizing to UTC, then converting back to PST8PDT, but that did not work.
import pandas as pd
import datetime as dt
from datetime import timedelta
Date_time = pd.to_datetime(df.DATE) + pd.Timedelta('8 hours')
Date_time = Date_time.dt.tz_localize('UTC')
Date_time = Date_time.dt.tz_convert('PST8PDT')
EDIT: Thank you for all the help! I localized with the fixed offset (UTC-8), but when I convert to 'America/Los_Angeles' or 'PST8PDT' it seems like all the datetimes are off by -8 or -7 hours, unless I am misunderstanding the datetime conventions.
To illustrate the problem:
Here's the raw time data 
Here's the datetime data after I localize to UTC with fixed offset 
And here's the datetime data after I convert to "America/Los_Angeles" time zone. 
As you can see, it applies Daylight Savings Time, however I am confused by the fact that all the datetimes say "-08:00" or "-07:00". Does that mean that 8 or 7 hours is being subtracted from each displayed datetime? Or am I misinterpreting that?
Either way, the good news is I found that if I just leave the data in UTC timezone with the fixed offset, I am able to work with it without any issues.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
