From e721b5e0a379d97e0d7a237376acfe585a77afc1 Mon Sep 17 00:00:00 2001 From: Kamil <32775019+quant12345@users.noreply.github.com> Date: Mon, 8 Jul 2024 12:25:22 +0500 Subject: [PATCH] Removes warning: "Passing literal json to 'read_json' is deprecated". (#2450) Co-authored-by: madtoinou <32447896+madtoinou@users.noreply.github.com> Co-authored-by: Dennis Bader --- darts/timeseries.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/darts/timeseries.py b/darts/timeseries.py index b34848426f..b58a6cc535 100644 --- a/darts/timeseries.py +++ b/darts/timeseries.py @@ -40,6 +40,7 @@ from collections import defaultdict from copy import deepcopy from inspect import signature +from io import StringIO from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import matplotlib.axes @@ -1247,7 +1248,7 @@ def from_json( TimeSeries The time series object converted from the JSON String """ - df = pd.read_json(json_str, orient="split") + df = pd.read_json(StringIO(json_str), orient="split") return cls.from_dataframe( df, static_covariates=static_covariates, hierarchy=hierarchy )