Fix websockets for dataframes with NaT entreis

This commit is contained in:
Matthias
2023-01-11 22:07:20 +01:00
parent f677dea6a4
commit 9d647fd193
2 changed files with 7 additions and 0 deletions

View File

@@ -269,6 +269,8 @@ def dataframe_to_json(dataframe: pd.DataFrame) -> str:
def default(z):
if isinstance(z, pd.Timestamp):
return z.timestamp() * 1e3
if z is pd.NaT:
return 'NaT'
raise TypeError
return str(orjson.dumps(dataframe.to_dict(orient='split'), default=default), 'utf-8')