From c463d5744bf293736f22f25fe67036601af6d2b1 Mon Sep 17 00:00:00 2001 From: Roger Yang <80478925+RogerHYang@users.noreply.github.com> Date: Thu, 21 Nov 2024 17:26:38 -0800 Subject: [PATCH] fix: add backup import for ujson_dumps from pandas.io.json (#5496) --- src/phoenix/utilities/json.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/phoenix/utilities/json.py b/src/phoenix/utilities/json.py index c9715da1d1..0b5c0bf8e3 100644 --- a/src/phoenix/utilities/json.py +++ b/src/phoenix/utilities/json.py @@ -8,11 +8,17 @@ import numpy as np import pandas as pd -from pandas.io.json import build_table_schema, ujson_dumps # type: ignore +from pandas.io.json import build_table_schema from pandas.io.json._table_schema import parse_table_schema # type: ignore from strawberry import UNSET from strawberry.types.base import StrawberryObjectDefinition +try: + from pandas.io.json import ujson_dumps # type: ignore +except ImportError: + # https://github.com/pandas-dev/pandas/pull/54581 + from pandas.io.json import dumps as ujson_dumps # type: ignore + def jsonify(obj: Any) -> Any: """