Skip to content

Commit 6642231

Browse files
committed
Fix issue with parsing pandas.Timestamp
1 parent 8ced45b commit 6642231

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.changeset/itchy-ducks-breathe.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@e2b/code-interpreter-template': patch
3+
---
4+
5+
Fix timestamp issue

template/startup_scripts/0002_data.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@ def _figure_repr_e2b_chart_(self: Figure):
2020

2121

2222
def _dataframe_repr_e2b_data_(self: pandas.DataFrame):
23-
return orjson.loads(orjson.dumps(self.to_dict(orient="list")))
23+
result = self.to_dict(orient="list")
24+
for key, value in result.items():
25+
# Check each column's values
26+
result[key] = [
27+
v.isoformat() if isinstance(v, pandas.Timestamp) else v for v in value
28+
]
29+
return result
2430

2531

2632
class E2BDataFormatter(BaseFormatter):

0 commit comments

Comments
 (0)