From 97a6fb285f894ba91b40dc8fa51d28d750d894b0 Mon Sep 17 00:00:00 2001 From: Timothy Pogue Date: Tue, 10 Jan 2023 17:52:24 -0700 Subject: [PATCH] revert to dataframe.to_json --- freqtrade/misc.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/freqtrade/misc.py b/freqtrade/misc.py index 93e8da6dd..7b9ff1f1d 100644 --- a/freqtrade/misc.py +++ b/freqtrade/misc.py @@ -10,7 +10,6 @@ from typing import Any, Dict, Iterator, List, Mapping, Union from typing.io import IO from urllib.parse import urlparse -import orjson import pandas as pd import rapidjson @@ -263,15 +262,7 @@ def dataframe_to_json(dataframe: pd.DataFrame) -> str: :param dataframe: A pandas DataFrame :returns: A JSON string of the pandas DataFrame """ - # https://github.com/pandas-dev/pandas/issues/24889 - # https://github.com/pandas-dev/pandas/issues/40443 - # We need to convert to a dict to avoid mem leak - def default(z): - if isinstance(z, pd.Timestamp): - return z.timestamp() * 1e3 - raise TypeError - - return str(orjson.dumps(dataframe.to_dict(orient='split'), default=default), 'utf-8') + return dataframe.to_json(orient='split') def json_to_dataframe(data: str) -> pd.DataFrame: