Skip to content

Commit

Permalink
fix(NpEncoder): handle pandas NA types
Browse files Browse the repository at this point in the history
  • Loading branch information
chanshing committed Jun 10, 2024
1 parent 9712886 commit 67415b0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/stepcount/stepcount.py
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,8 @@ def default(self, obj):
return float(obj)
if isinstance(obj, np.ndarray):
return obj.tolist()
if pd.isnull(obj): # handles pandas NAType
return np.nan
return json.JSONEncoder.default(self, obj)


Expand Down

0 comments on commit 67415b0

Please sign in to comment.