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

pandas.Series does not allow adding timedeltas to series of timestamps with datetime information #10763

Closed
katastrofa999 opened this Issue Aug 7, 2015 · 4 comments

Comments

Projects
None yet
2 participants
@katastrofa999

katastrofa999 commented Aug 7, 2015

xref #10477

It is possible with numpy, but not with pandas:

import numpy as np
import pandas as pd

ts1 = pd.Timestamp('2015-07-01 10:00:00').tz_localize('Europe/London')
ts2 = pd.Timestamp('2015-07-01 11:00:00').tz_localize('Europe/London')
dt = ts2 - ts1

x = np.array([ts1, ts2])
print(x)
dx = np.array([dt, dt])
print(x + dx)

s = pd.Series([ts1, ts2])
print(s)
ds = pd.Series([dt, dt])
print(s + ds)

s + ds throws an error ufunc add cannot use operands with types dtype('O') and dtype('<m8[ns]')

@jreback

This comment has been minimized.

Show comment
Hide comment
@jreback

jreback Aug 7, 2015

Contributor

pls pd.show_versions()

Contributor

jreback commented Aug 7, 2015

pls pd.show_versions()

@jreback

This comment has been minimized.

Show comment
Hide comment
@jreback

jreback Aug 7, 2015

Contributor

this by definition won't work because tzs are not a real dtype (coming soon though)

and FYI numpy looks like it works but is actually do the wrong thing - it silently coerces to UTC

Contributor

jreback commented Aug 7, 2015

this by definition won't work because tzs are not a real dtype (coming soon though)

and FYI numpy looks like it works but is actually do the wrong thing - it silently coerces to UTC

@katastrofa999

This comment has been minimized.

Show comment
Hide comment
@katastrofa999

katastrofa999 Aug 7, 2015

INSTALLED VERSIONS

commit: None
python: 2.7.3.final.0
python-bits: 64
OS: Linux
OS-release: 2.6.32-220.4.2.el6.x86_64
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8

pandas: 0.15.2
nose: 1.3.0
Cython: 0.21.1
numpy: 1.9.1
scipy: 0.15.1
statsmodels: 0.5.0.dev-Unknown
IPython: 0.13.1
sphinx: 1.1.3
patsy: 0.2.1
dateutil: 2.1
pytz: 2015.4
bottleneck: None
tables: 3.1.1
numexpr: 2.4
matplotlib: 1.2.1
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: 0.8
apiclient: None
rpy2: None
sqlalchemy: 0.8.0
pymysql: None
psycopg2: None

katastrofa999 commented Aug 7, 2015

INSTALLED VERSIONS

commit: None
python: 2.7.3.final.0
python-bits: 64
OS: Linux
OS-release: 2.6.32-220.4.2.el6.x86_64
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8

pandas: 0.15.2
nose: 1.3.0
Cython: 0.21.1
numpy: 1.9.1
scipy: 0.15.1
statsmodels: 0.5.0.dev-Unknown
IPython: 0.13.1
sphinx: 1.1.3
patsy: 0.2.1
dateutil: 2.1
pytz: 2015.4
bottleneck: None
tables: 3.1.1
numexpr: 2.4
matplotlib: 1.2.1
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: 0.8
apiclient: None
rpy2: None
sqlalchemy: 0.8.0
pymysql: None
psycopg2: None

@katastrofa999

This comment has been minimized.

Show comment
Hide comment
@katastrofa999

katastrofa999 Aug 7, 2015

So the only option is to do it row-by-row?

katastrofa999 commented Aug 7, 2015

So the only option is to do it row-by-row?

@jreback jreback added this to the 0.17.0 milestone Aug 7, 2015

@jreback jreback referenced this issue Aug 7, 2015

Merged

API: add DatetimeBlockTZ #8260 #10477

5 of 5 tasks complete

jreback added a commit to jreback/pandas that referenced this issue Aug 14, 2015

API: add DatetimeBlockTZ pandas-dev#8260
fix scalar comparisons vs None generally

fix NaT formattting in Series

TST: skip postgresql test with tz's

update for msgpack

Conflicts:
	pandas/core/base.py
	pandas/core/categorical.py
	pandas/core/format.py
	pandas/tests/test_base.py
	pandas/util/testing.py

full interop for tz-aware Series & timedeltas pandas-dev#10763

jreback added a commit to jreback/pandas that referenced this issue Sep 5, 2015

API: add DatetimeBlockTZ pandas-dev#8260
fix scalar comparisons vs None generally

fix NaT formattting in Series

TST: skip postgresql test with tz's

update for msgpack

Conflicts:
	pandas/core/base.py
	pandas/core/categorical.py
	pandas/core/format.py
	pandas/tests/test_base.py
	pandas/util/testing.py

full interop for tz-aware Series & timedeltas pandas-dev#10763

nickeubank added a commit to nickeubank/pandas that referenced this issue Sep 29, 2015

API: add DatetimeBlockTZ pandas-dev#8260
fix scalar comparisons vs None generally

fix NaT formattting in Series

TST: skip postgresql test with tz's

update for msgpack

Conflicts:
	pandas/core/base.py
	pandas/core/categorical.py
	pandas/core/format.py
	pandas/tests/test_base.py
	pandas/util/testing.py

full interop for tz-aware Series & timedeltas pandas-dev#10763
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment