Skip to content

'date_range' no longer has a true "24H" frequency #8774

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
broessli opened this issue Nov 10, 2014 · 4 comments
Closed

'date_range' no longer has a true "24H" frequency #8774

broessli opened this issue Nov 10, 2014 · 4 comments
Labels
Duplicate Report Duplicate issue or pull request Frequency DateOffsets

Comments

@broessli
Copy link

The semantic of the frequencies "D" and "24H" in 'date_range' has changed in pandas 0.15.0: they are now both equivalent to a "calendar daily" frequency, ie local time is kept the same across DST transition:

In [1]: import pandas as pd;pd.__version__
Out[1]: '0.15.0'
In [2]: list(pd.date_range(pd.Timestamp("2014-10-24 06:00", tz="Europe/Paris"), periods=4, freq="D"))
Out[2]:
[Timestamp('2014-10-24 06:00:00+0200', tz='Europe/Paris', offset='D'),
 Timestamp('2014-10-25 06:00:00+0200', tz='Europe/Paris', offset='D'),
 Timestamp('2014-10-26 06:00:00+0100', tz='Europe/Paris', offset='D'),
 Timestamp('2014-10-27 06:00:00+0100', tz='Europe/Paris', offset='D')]
In [3]: list(pd.date_range(pd.Timestamp("2014-10-24 06:00", tz="Europe/Paris"), periods=4, freq="24H"))
Out[3]:
[Timestamp('2014-10-24 06:00:00+0200', tz='Europe/Paris', offset='24H'),
 Timestamp('2014-10-25 06:00:00+0200', tz='Europe/Paris', offset='24H'),
 Timestamp('2014-10-26 06:00:00+0100', tz='Europe/Paris', offset='24H'),
 Timestamp('2014-10-27 06:00:00+0100', tz='Europe/Paris', offset='24H')]

But what if we do want a true "24H" frequency ? I think "D" and "24H" should not share the same semantic, Out[2] is OK but Out[3] should be:

[Timestamp('2014-10-24 06:00:00+0200', tz='Europe/Paris'),
 Timestamp('2014-10-25 06:00:00+0200', tz='Europe/Paris'),
 Timestamp('2014-10-26 05:00:00+0100', tz='Europe/Paris'),
 Timestamp('2014-10-27 05:00:00+0100', tz='Europe/Paris')]
@rockg
Copy link
Contributor

rockg commented Nov 10, 2014

See #7825 for a similar discussion. There is a comment mentioning that 24H and D are equivalent in the context of date_range. To me 24H should be what you describe and D should retain its current behavior (did they used to be different?).

@broessli
Copy link
Author

Thx for the link, this is indeed the same issue, hope others will agree with us that "D" should be != "24H". They always have had the same semantic, but in previous pandas versions "D" and "24H" meant true 24 hours intervals: one just had to accept that "D" was exactly 24 hours to make sense of date_range behavior. Now with pandas 0.15.0, "D" and "24H" stand for "calendar daily" frequencies and it is harder to think of "24H" as a "calendar day" which can have 23, 24 or 25 hours.

@jreback
Copy link
Contributor

jreback commented Nov 11, 2014

@rockg is this a dupe of that TL;DR discussion in #7825 (well I did read it, but many issues brought up)!

@jreback jreback added the Frequency DateOffsets label Nov 11, 2014
@jreback jreback added this to the No action milestone Apr 9, 2018
@jreback jreback added the Duplicate Report Duplicate issue or pull request label Apr 9, 2018
@jreback
Copy link
Contributor

jreback commented Apr 9, 2018

consolidated to #20633

@jreback jreback closed this as completed Apr 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate Report Duplicate issue or pull request Frequency DateOffsets
Projects
None yet
Development

No branches or pull requests

3 participants