Skip to content

Commit

Permalink
Fix issue with parsing pandas.Timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubno committed Jan 9, 2025
1 parent 8ced45b commit 6642231
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/itchy-ducks-breathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@e2b/code-interpreter-template': patch
---

Fix timestamp issue
8 changes: 7 additions & 1 deletion template/startup_scripts/0002_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ def _figure_repr_e2b_chart_(self: Figure):


def _dataframe_repr_e2b_data_(self: pandas.DataFrame):
return orjson.loads(orjson.dumps(self.to_dict(orient="list")))
result = self.to_dict(orient="list")
for key, value in result.items():
# Check each column's values
result[key] = [
v.isoformat() if isinstance(v, pandas.Timestamp) else v for v in value
]
return result


class E2BDataFormatter(BaseFormatter):
Expand Down

0 comments on commit 6642231

Please sign in to comment.