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

#7610 data frame serialization for python autotranslation #7624

Merged
merged 1 commit into from
Jul 2, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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