Skip to content

Commit 7517322

Browse files
committed
interval: please pandas 0.25
1 parent ce19e59 commit 7517322

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

test/test_tsio.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ def test_differential(engine, tsh):
150150
assert not tsh.exists(engine, 'this_does_not_exist')
151151

152152
assert tsh.interval(engine, 'ts_test') == pd.Interval(
153-
datetime(2010, 1, 1, 0, 0), datetime(2010, 1, 10, 0, 0),
153+
pd.Timestamp(datetime(2010, 1, 1, 0, 0)),
154+
pd.Timestamp(datetime(2010, 1, 10, 0, 0)),
154155
closed='both'
155156
)
156157

@@ -244,7 +245,8 @@ def test_differential(engine, tsh):
244245
""", tsh.get(engine, 'ts_test'))
245246

246247
assert tsh.interval(engine, 'ts_test') == pd.Interval(
247-
datetime(2010, 1, 1, 0, 0), datetime(2010, 1, 17, 0, 0),
248+
pd.Timestamp(datetime(2010, 1, 1, 0, 0)),
249+
pd.Timestamp(datetime(2010, 1, 17, 0, 0)),
248250
closed='both'
249251
)
250252

tshistory/tsio.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,10 @@ def interval(self, cn, name, notz=False):
423423
f'order by id desc limit 1')
424424
res = cn.execute(sql).fetchone()
425425
start, end = res.tsstart, res.tsend
426+
tz = None
426427
if self.metadata(cn, name).get('tzaware') and not notz:
427-
start, end = pd.Timestamp(start, tz='UTC'), pd.Timestamp(end, tz='UTC')
428+
tz = 'UTC'
429+
start, end = pd.Timestamp(start, tz=tz), pd.Timestamp(end, tz=tz)
428430
return pd.Interval(left=start, right=end, closed='both')
429431

430432
# /API

0 commit comments

Comments
 (0)