A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pandas-dev/pandas/issues/7835 below:

date_range(str, tz=str) and date_range(Timestamp) handle tz discontinuity differently · Issue #7835 · pandas-dev/pandas · GitHub

xref #7825
xref (addtl test cases) #7901

I believe Out[2] is correct and Out[3] is a bug, and that others will agree with me.
I believe Out[4] is a bug, Out[7] is correct and Out[10] is a bug, but that I will have to do some work to convince others to agree with me.

In [1]: import pandas as pd

In [2]: list(pd.date_range('2013-11-1', tz='America/Chicago', periods=7, freq='D'))
Out[2]: 
[Timestamp('2013-11-01 00:00:00-0500', tz='America/Chicago', offset='D'),
 Timestamp('2013-11-02 00:00:00-0500', tz='America/Chicago', offset='D'),
 Timestamp('2013-11-03 00:00:00-0500', tz='America/Chicago', offset='D'),
 Timestamp('2013-11-04 00:00:00-0600', tz='America/Chicago', offset='D'),
 Timestamp('2013-11-05 00:00:00-0600', tz='America/Chicago', offset='D'),
 Timestamp('2013-11-06 00:00:00-0600', tz='America/Chicago', offset='D'),
 Timestamp('2013-11-07 00:00:00-0600', tz='America/Chicago', offset='D')]

In [3]: list(pd.date_range(pd.Timestamp('2013-11-1', tz='America/Chicago'), periods=7, freq='D'))
Out[3]: 
[Timestamp('2013-11-01 00:00:00-0500', tz='America/Chicago', offset='D'),
 Timestamp('2013-11-02 00:00:00-0500', tz='America/Chicago', offset='D'),
 Timestamp('2013-11-03 00:00:00-0500', tz='America/Chicago', offset='D'),
 Timestamp('2013-11-03 23:00:00-0600', tz='America/Chicago', offset='D'),
 Timestamp('2013-11-04 23:00:00-0600', tz='America/Chicago', offset='D'),
 Timestamp('2013-11-05 23:00:00-0600', tz='America/Chicago', offset='D'),
 Timestamp('2013-11-06 23:00:00-0600', tz='America/Chicago', offset='D')]

In [4]: list(pd.date_range('2013-11-1', tz='America/Chicago', periods=7, freq='24H'))
Out[4]: 
[Timestamp('2013-11-01 00:00:00-0500', tz='America/Chicago', offset='24H'),
 Timestamp('2013-11-02 00:00:00-0500', tz='America/Chicago', offset='24H'),
 Timestamp('2013-11-03 00:00:00-0500', tz='America/Chicago', offset='24H'),
 Timestamp('2013-11-04 00:00:00-0600', tz='America/Chicago', offset='24H'),
 Timestamp('2013-11-05 00:00:00-0600', tz='America/Chicago', offset='24H'),
 Timestamp('2013-11-06 00:00:00-0600', tz='America/Chicago', offset='24H'),
 Timestamp('2013-11-07 00:00:00-0600', tz='America/Chicago', offset='24H')]

In [5]: out = [pd.Timestamp('2013-11-1', tz='America/Chicago')]

In [6]: for i in range(6):
   ...:     out.append(out[-1] + pd.offsets.Hour(24))
   ...:      

In [7]: out
Out[7]: 
[Timestamp('2013-11-01 00:00:00-0500', tz='America/Chicago'),
 Timestamp('2013-11-02 00:00:00-0500', tz='America/Chicago'),
 Timestamp('2013-11-03 00:00:00-0500', tz='America/Chicago'),
 Timestamp('2013-11-03 23:00:00-0600', tz='America/Chicago'),
 Timestamp('2013-11-04 23:00:00-0600', tz='America/Chicago'),
 Timestamp('2013-11-05 23:00:00-0600', tz='America/Chicago'),
 Timestamp('2013-11-06 23:00:00-0600', tz='America/Chicago')]

In [8]: out = [pd.Timestamp('2013-11-1', tz='America/Chicago')]

In [9]: for i in range(6):
   ...:     out.append(out[-1] + pd.offsets.Day(1))
   ...:      

In [10]: out
Out[10]: 
[Timestamp('2013-11-01 00:00:00-0500', tz='America/Chicago'),
 Timestamp('2013-11-02 00:00:00-0500', tz='America/Chicago'),
 Timestamp('2013-11-03 00:00:00-0500', tz='America/Chicago'),
 Timestamp('2013-11-03 23:00:00-0600', tz='America/Chicago'),
 Timestamp('2013-11-04 23:00:00-0600', tz='America/Chicago'),
 Timestamp('2013-11-05 23:00:00-0600', tz='America/Chicago'),
 Timestamp('2013-11-06 23:00:00-0600', tz='America/Chicago')]

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4