Skip to content
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

BUG: Fix tz handling in date_range when start arg has tz, #2926 #2927

Closed
wants to merge 2 commits into from
Closed

BUG: Fix tz handling in date_range when start arg has tz, #2926 #2927

wants to merge 2 commits into from

Conversation

Moisan
Copy link
Contributor

@Moisan Moisan commented Feb 25, 2013

This commit should fix issue 2926.

@ghost
Copy link

ghost commented Feb 25, 2013

tests please.

@Moisan
Copy link
Contributor Author

Moisan commented Feb 25, 2013

I tested with nosetests pandas and everything was OK. Do you want some sort of output?

@ghost
Copy link

ghost commented Feb 25, 2013

Sorry, I meant you've fixed a bug which isn't caught by the current test suite,
so it's important to add a test that fails before the fix and demonstrates that your
change indeed corrects the bug. It'll also prevent future regressions if someone
modifies that part of the code.

The tests covering date_range live at pandas/tseries/tests/test_daterange.py,
please add a new test there.

@xdong
Copy link

xdong commented Feb 25, 2013

Hi Moisan,

I am using the stable release 10.1. It's not easy for me to test the latest commit right now. Could you check if your patch fixes the following:

(1) issue #2906 date_range bug?

(2) I found a related bug when using concat:

In [17]: from pandas import *

In [18]: dates_a = [Timestamp('20130219 13:00', tz='US/Eastern'), Timestamp('20130220 13:00', tz='US/Eastern')]

In [19]: dates_b = [Timestamp('20130222 13:00', tz='US/Eastern'), Timestamp('20130223 13:00', tz='US/Eastern')]

In [20]: a = Series(range(2), dates_a)

In [21]: b = Series(range(2), dates_b)

In [22]: concat([a, b])
Out[22]:
2013-02-19 18:00:00-05:00 0
2013-02-20 18:00:00-05:00 1
2013-02-22 18:00:00-05:00 0
2013-02-23 18:00:00-05:00 1

Note that the index of Out[22] is wrong (time shifted by 5 hours).

@Moisan
Copy link
Contributor Author

Moisan commented Feb 25, 2013

Hi xdong,

No my patch does not fix either of these issues. However I do believe they are related to each other. I tried to force the timezone in issue 2906 and found another bug and opened issue 2926. I'll go back to issue 2906 soon :).

@wesm
Copy link
Member

wesm commented Mar 28, 2013

Cherry-picked, thank you!

@wesm wesm closed this Mar 28, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

date_range with a given timezone fails if the start argument also has a timezone.
3 participants