Skip to content

Commit

Permalink
#7610 data frame serialization for python autotranslation
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukasz Mitusinski committed Jul 2, 2018
1 parent 4d4eb52 commit 6bacb55
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions beakerx/beakerx/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def transformBack(obj):
c.addItem(i)
return c
if out['type'] == "Date":
return datetime.datetime.fromtimestamp(out["timestamp"]/1000)
return datetime.fromtimestamp(out["timestamp"]/1000)
if out['type'] == "TableDisplay":
if 'subtype' in out:
if out['subtype'] == "Dictionary":
Expand Down Expand Up @@ -361,7 +361,7 @@ def default(self, obj):
ret = obj.tolist()
transformNaNs(ret)
return ret
if type(obj) == datetime.datetime or type(obj) == datetime.date or type(obj).__name__ == 'Timestamp':
if type(obj) == datetime or type(obj) == datetime.date or type(obj).__name__ == 'Timestamp':
out = {}
out['type'] = "Date"
out['timestamp'] = time.mktime(obj.timetuple()) * 1000
Expand Down Expand Up @@ -594,7 +594,7 @@ def autotranslation_update(var, val):
session_id = get_context_session()
port = os.environ["BEAKERX_AUTOTRANSLATION_PORT"]
url = 'http://localhost:{0}/autotransltion/'.format(port)
json_data = json.dumps(transform(val))
json_data = json.dumps(transform(val), cls=DataFrameEncoder)
data = {}
data["name"] = var
data["json"] = json_data
Expand Down

0 comments on commit 6bacb55

Please sign in to comment.