Skip to content

Commit f39fc69

Browse files
mckelvinbmoscon
authored andcommitted
Timestamp.to_datetime is deprecated in pandas (pandas-dev#300)
Use `.to_pydatetime` instead which has been in pandas since 0.10.0
1 parent ed6f733 commit f39fc69

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

arctic/tickstore/tickstore.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -520,8 +520,8 @@ def write(self, symbol, data, initial_image=None):
520520
start = data[0]['index']
521521
end = data[-1]['index']
522522
elif isinstance(data, pd.DataFrame):
523-
start = data.index[0].to_datetime()
524-
end = data.index[-1].to_datetime()
523+
start = data.index[0].to_pydatetime()
524+
end = data.index[-1].to_pydatetime()
525525
pandas = True
526526
else:
527527
raise UnhandledDtypeException("Can't persist type %s to tickstore" % type(data))
@@ -609,18 +609,18 @@ def _pandas_compute_final_image(df, image, end):
609609
@staticmethod
610610
def _pandas_to_bucket(df, symbol, initial_image):
611611
rtn = {SYMBOL: symbol, VERSION: CHUNK_VERSION_NUMBER, COLUMNS: {}, COUNT: len(df)}
612-
end = to_dt(df.index[-1].to_datetime())
612+
end = to_dt(df.index[-1].to_pydatetime())
613613
if initial_image :
614614
if 'index' in initial_image:
615-
start = min(to_dt(df.index[0].to_datetime()), initial_image['index'])
615+
start = min(to_dt(df.index[0].to_pydatetime()), initial_image['index'])
616616
else:
617-
start = to_dt(df.index[0].to_datetime())
617+
start = to_dt(df.index[0].to_pydatetime())
618618
image_start = initial_image.get('index', start)
619619
image = {k: v for k, v in initial_image.items() if k != 'index'}
620620
rtn[IMAGE_DOC] = {IMAGE_TIME: image_start, IMAGE: initial_image}
621621
final_image = TickStore._pandas_compute_final_image(df, initial_image, end)
622622
else:
623-
start = to_dt(df.index[0].to_datetime())
623+
start = to_dt(df.index[0].to_pydatetime())
624624
final_image = {}
625625
rtn[END] = end
626626
rtn[START] = start

0 commit comments

Comments
 (0)