Skip to content

Commit ecab560

Browse files
author
Eric Novotny
committed
fix null copying
1 parent 82febeb commit ecab560

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

cwms/timeseries/timeseries.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,14 @@ def combine_timeseries_results(results: List[Data]) -> Data:
233233
)
234234
combined_df["date-time"] = combined_df["date-time"].astype("Int64")
235235
combined_df = combined_df.reindex(columns=["date-time", "value", "quality-code"])
236+
237+
# Replace NaN in value column with None so they serialize as JSON null
238+
# rather than the invalid JSON literal NaN.
239+
combined_df["value"] = (
240+
combined_df["value"]
241+
.astype(object)
242+
.where(combined_df["value"].notna(), other=None)
243+
)
236244
# Update the "values" key in the JSON to include the combined data
237245
combined_json["values"] = combined_df.values.tolist()
238246

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "cwms-python"
33
repository = "https://github.com/HydrologicEngineeringCenter/cwms-python"
44

5-
version = "1.0.4"
5+
version = "1.0.6"
66

77

88
packages = [

0 commit comments

Comments
 (0)