Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated download_array to properly read from literal string using StringIO wrapper #218

Merged
merged 2 commits into from
Apr 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cleanlab_studio/internal/api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import pandas as pd
import numpy as np
import numpy.typing as npt
from io import StringIO

try:
import snowflake
Expand Down Expand Up @@ -308,7 +309,7 @@ def download_array(
if res_json["array_type"] == "numpy":
np_data: npt.NDArray[np.float_] = np.array(res_json[name])
return np_data
pd_data: pd.DataFrame = pd.read_json(res_json[name], orient="records")
pd_data: pd.DataFrame = pd.read_json(StringIO(res_json[name]), orient="records")
return pd_data
raise APIError(f"{name} for cleanset {cleanset_id} not found")

Expand Down
Loading