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

Series[datetime64tz] - DatetimeIndex[tz] raises ValueError #19071

Closed
jbrockmendel opened this issue Jan 4, 2018 · 1 comment · Fixed by #19072
Closed

Series[datetime64tz] - DatetimeIndex[tz] raises ValueError #19071

jbrockmendel opened this issue Jan 4, 2018 · 1 comment · Fixed by #19072
Labels
Datetime Datetime data dtype Testing pandas testing functions or related to the test suite
Milestone

Comments

@jbrockmendel
Copy link
Member

Opening an issue mostly so the upcoming PR can reference it. This is in fact already fixed in master (at least as of 9303315), so the PR is just a test.

Setup:

dti = pd.date_range('1999-09-30', periods=10, tz='US/Pacific')
ser = pd.Series(dti)

0.22.0:

>>> ser - dti
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/pandas/core/ops.py", line 720, in wrapper
    converted = _Op.get_op(left, right, name, na_op)
  File "/usr/local/lib/python2.7/site-packages/pandas/core/ops.py", line 349, in get_op
    return _TimeOp(left, right, name, na_op)
  File "/usr/local/lib/python2.7/site-packages/pandas/core/ops.py", line 385, in __init__
    self._validate(lvalues, rvalues, name)
  File "/usr/local/lib/python2.7/site-packages/pandas/core/ops.py", line 444, in _validate
    raise ValueError("Incompatible tz's on datetime subtraction "
ValueError: Incompatible tz's on datetime subtraction ops

>>> dti - ser
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/pandas/core/ops.py", line 720, in wrapper
    converted = _Op.get_op(left, right, name, na_op)
  File "/usr/local/lib/python2.7/site-packages/pandas/core/ops.py", line 349, in get_op
    return _TimeOp(left, right, name, na_op)
  File "/usr/local/lib/python2.7/site-packages/pandas/core/ops.py", line 385, in __init__
    self._validate(lvalues, rvalues, name)
  File "/usr/local/lib/python2.7/site-packages/pandas/core/ops.py", line 444, in _validate
    raise ValueError("Incompatible tz's on datetime subtraction "
ValueError: Incompatible tz's on datetime subtraction ops
@jreback
Copy link
Contributor

jreback commented Jan 4, 2018

you don’t need to open issues just to reference
simply use the PR number

@gfyoung gfyoung added Admin Administrative tasks related to the pandas project Datetime Datetime data dtype Testing pandas testing functions or related to the test suite and removed Admin Administrative tasks related to the pandas project labels Jan 4, 2018
@jreback jreback added this to the 0.23.0 milestone Jan 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants