I have a column (non-index column) that has datetimes inside it. For example, the first five entries look something like this:
[Timestamp('2018-11-15 19:57:55'),
Timestamp('2018-11-15 19:59:46'),
Timestamp('2018-11-15 20:00:59'),
Timestamp('2018-11-15 20:01:41'),
Timestamp('2018-11-15 20:01:54')]
I want to convert the entries from UTC to the Pacific timezone. Assuming the column is called times
I am currently doing the following:
times.dt.tz_localize('GMT').dt.tz_convert('America/Los_Angeles')
While this successfully converts the column from UTC to PST, the output has extraneous components that I do not want. It looks like the following:
[Timestamp('2018-11-15 11:57:55-0800', tz='America/Los_Angeles'),
Timestamp('2018-11-15 11:59:46-0800', tz='America/Los_Angeles'),
Timestamp('2018-11-15 12:00:59-0800', tz='America/Los_Angeles'),
Timestamp('2018-11-15 12:01:41-0800', tz='America/Los_Angeles'),
Timestamp('2018-11-15 12:01:54-0800', tz='America/Los_Angeles')]
How do I remove or ignore the -0800
from the timestamps? Thanks!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…