Wrapped json strings with StringIO to address deprecation warnings

This commit is contained in:
HowToSD
2025-02-13 16:59:46 -08:00
parent 9755ed6aac
commit 9aec9f2b6b
13 changed files with 25 additions and 14 deletions
+2 -1
View File
@@ -1,5 +1,6 @@
from typing import Any, Dict
from matplotlib import pyplot as plt
from io import StringIO
import pandas as pd
from .common import common_input_types
from .util import plot_post_steps
@@ -49,7 +50,7 @@ class MPLBar:
tuple: A tuple containing the image tensor representation of the plot.
"""
# Deserialize JSON string to DataFrame
df = pd.read_json(dataframe_json)
df = pd.read_json(StringIO(dataframe_json))
# Create the plot
fig, ax = plt.subplots()
+2 -1
View File
@@ -1,5 +1,6 @@
from typing import Any, Dict
from matplotlib import pyplot as plt
from io import StringIO
import pandas as pd
from .common import common_input_types
from .util import plot_post_steps
@@ -49,7 +50,7 @@ class MPLLine:
tuple: A tuple containing the image tensor representation of the plot.
"""
# Deserialize JSON string to DataFrame
df = pd.read_json(dataframe_json)
df = pd.read_json(StringIO(dataframe_json))
# Create the plot
fig, ax = plt.subplots()
+2 -1
View File
@@ -1,5 +1,6 @@
from typing import Any, Dict
from matplotlib import pyplot as plt
from io import StringIO
import pandas as pd
from .common import common_input_types
from .util import plot_post_steps
@@ -49,7 +50,7 @@ class MPLScatter:
tuple: A tuple containing the image tensor representation of the plot.
"""
# Deserialize JSON string to DataFrame
df = pd.read_json(dataframe_json)
df = pd.read_json(StringIO(dataframe_json))
# Create the plot
fig, ax = plt.subplots()