Skip to content

date_range bug? #2906

Closed
Closed
@xdong

Description

@xdong

If 'start' is a timezone-aware datetime.datetime or Timestamp, then it will get shifted by several hours.

In [1]: from pandas import *

In [2]: start = Timestamp('20130220 10:00', tz='US/Eastern')

In [3]: start
Out[3]: <Timestamp: 2013-02-20 10:00:00-0500 EST, tz=US/Eastern>

In [4]: dr = date_range(start, periods=2)

In [5]: dr
Out[5]: 
<class 'pandas.tseries.index.DatetimeIndex'>
[2013-02-20 15:00:00, 2013-02-21 15:00:00]
Length: 2, Freq: D, Timezone: US/Eastern

In [6]: dr[0]
Out[6]: <Timestamp: 2013-02-20 15:00:00-0500 EST, tz=US/Eastern>

It seems that start' time component was treated as if it's UTC by date_range.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions