Skip to content

Commit

Permalink
save date in json, fixes (#651)
Browse files Browse the repository at this point in the history
  • Loading branch information
pplonski committed Sep 26, 2023
1 parent 5775bac commit 2a22f03
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions supervised/utils/jsonencoder.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json
import numpy as np

from datetime import date

class MLJSONEncoder(json.JSONEncoder):
def default(self, o):
Expand All @@ -25,5 +25,7 @@ def default(self, o):
return float(o)
elif isinstance(o, np.ndarray):
return o.tolist()
elif isinstance(obj, date):
return obj.strftime("%Y-%m-%d")

return super().default(o)
return super(MLJSONEncoder, self).default(o)

0 comments on commit 2a22f03

Please sign in to comment.