about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2025-09-04 20:00:31 +0100
committerArun Isaac2025-09-04 20:00:31 +0100
commit5894ac377c04b4af187309b132c132ff216bb571 (patch)
treeab04d63be319ddce67fed54dfedf57773444ddd6
parentd94e8b06e2e11374a074cca02a71c4ba358be172 (diff)
downloadpyhegp-5894ac377c04b4af187309b132c132ff216bb571.tar.gz
pyhegp-5894ac377c04b4af187309b132c132ff216bb571.tar.lz
pyhegp-5894ac377c04b4af187309b132c132ff216bb571.zip
Raise exception if data frame to be written has NA values.
This should never occur, but can occur due to bugs in the code; we
wish to protect against that.
-rw-r--r--pyhegp/serialization.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/pyhegp/serialization.py b/pyhegp/serialization.py
index c197bf2..db1360a 100644
--- a/pyhegp/serialization.py
+++ b/pyhegp/serialization.py
@@ -108,6 +108,8 @@ def read_phenotype(file):
     return df
 
 def write_tsv(file, df):
+    if df.isna().any(axis=None):
+        raise ValueError("Data frame has NA values")
     df.to_csv(file,
               quoting=csv.QUOTE_NONE,
               sep="\t",