diff --git a/ui/sdk/src/hamilton_sdk/tracking/utils.py b/ui/sdk/src/hamilton_sdk/tracking/utils.py index 6c4eab685..b0e515d8a 100644 --- a/ui/sdk/src/hamilton_sdk/tracking/utils.py +++ b/ui/sdk/src/hamilton_sdk/tracking/utils.py @@ -48,6 +48,8 @@ def make_json_safe(item: Union[dict, list, str, float, int, bool]) -> Any: # we convert to json string and then deserialize it so that # it's not a string in the UI. try: + if hasattr(item, "head"): + item = item.head() # truncate to head rows if it's a dataframe return json.loads(item.to_json()) except Exception: # pass diff --git a/ui/sdk/tests/tracking/test_utils.py b/ui/sdk/tests/tracking/test_utils.py index 6f522a4aa..eb85d52be 100644 --- a/ui/sdk/tests/tracking/test_utils.py +++ b/ui/sdk/tests/tracking/test_utils.py @@ -139,7 +139,7 @@ def test_make_json_safe_with_pandas_series(): "1642291200000": 50, "1642896000000": 100, "1643500800000": 200, - "1644105600000": 400, + # "1644105600000": 400, -- skipped due to `.head()` being called }