Skip to content

Commit

Permalink
Replace nan with empty string in distribution response (#55)
Browse files Browse the repository at this point in the history
* replace nan with empty string

* remove print statement
  • Loading branch information
vpnu authored Jan 24, 2025
1 parent b975255 commit 283abc1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/hutch_bunny/core/query_solvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,8 @@ def solve_query(self) -> Tuple[str, int]:
)
for _, row in concepts_df.iterrows():
df.loc[df["OMOP"] == row["concept_id"], "OMOP_DESCR"] = row["concept_name"]

# replace NaN values with empty string
df = df.fillna('')
# Convert df to tab separated string
results = list(["\t".join(df.columns)])
for _, row in df.iterrows():
Expand Down Expand Up @@ -564,6 +565,7 @@ def solve_distribution(
res_b64_bytes = base64.b64encode(res.encode("utf-8")) # bytes
size = len(res_b64_bytes) / 1000 # length of file data in KB
res_b64 = res_b64_bytes.decode("utf-8") # convert back to string, now base64

result_file = File(
data=res_b64,
description="Result of code.distribution anaylsis",
Expand Down

0 comments on commit 283abc1

Please sign in to comment.