Skip to content

BUG: Right result for DatetimeIndex + TimeDelta when timezone is set(… #13935

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

Conversation

conquistador1492
Copy link
Contributor

#13905)

@@ -461,7 +461,7 @@ def _convert_to_array(self, values, name=None, other=None):

# a datelike
elif isinstance(values, pd.DatetimeIndex):
values = values.to_series()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should handle is_datetime64_dtype and is_datetime64tz_dtype separately here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it happens, isn't is?

@jreback jreback added Bug Timedelta Timedelta data type Timezones Timezone data dtype labels Aug 8, 2016
@codecov-io
Copy link

codecov-io commented Aug 8, 2016

Current coverage is 85.30% (diff: 100%)

Merging #13935 into master will increase coverage by <.01%

@@             master     #13935   diff @@
==========================================
  Files           139        139          
  Lines         50157      50161     +4   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits          42785      42790     +5   
+ Misses         7372       7371     -1   
  Partials          0          0          

Powered by Codecov. Last update b7abef4...b17da31

@@ -543,9 +543,9 @@ def _offset(lvalues, rvalues):

# with tz, convert to UTC
if self.is_datetime64tz_lhs:
lvalues = lvalues.tz_localize(None)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this localization can be removed, as adding timedelta is unrelated to the timezone.

@sinhrks
Copy link
Member

sinhrks commented Aug 8, 2016

Pls add a test for Index constructor covering possible patterns.

@sinhrks sinhrks modified the milestone: 0.19.0 Aug 8, 2016
@jreback
Copy link
Contributor

jreback commented Aug 8, 2016

acutally need to localize if freq < 1D, otherwise can simply add it.

E.g. if we are crossing a dst boundary, then need to convert to UTC, operate, then re-convert.

So I think we should continue to always convert / operate / re-convert for simplicity.

@sinhrks
Copy link
Member

sinhrks commented Aug 8, 2016

@jreback you're right, but DatetimeIndex itself handles this, so not needed in ops.py?

@jreback
Copy link
Contributor

jreback commented Sep 9, 2016

can you rebase / update?

@jreback
Copy link
Contributor

jreback commented Nov 16, 2016

can you rebase / update

1 similar comment
@jreback
Copy link
Contributor

jreback commented Dec 21, 2016

can you rebase / update

@jreback
Copy link
Contributor

jreback commented Dec 30, 2016

closing, but if you want to update, pls comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Timedelta Timedelta data type Timezones Timezone data dtype
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DatetimeIndex + TimeDelta gives wrong results when timezone is set
5 participants