Skip to content

Commit

Permalink
replace nan with empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
vpnu committed Jan 24, 2025
1 parent 666caea commit 98bf55e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/hutch_bunny/core/query_solvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,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 @@ -481,10 +482,12 @@ def solve_distribution(
solver = _get_distribution_solver(db_manager, query)
try:
res, count = solver.solve_query()
print(res)
# Convert file data to base64
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 98bf55e

Please sign in to comment.