summaryrefslogtreecommitdiff
path: root/lib/dfatool.py
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2017-05-30 15:58:32 +0200
committerDaniel Friesel <derf@finalrewind.org>2017-05-30 15:58:32 +0200
commit6b45e9720286d21aee1de6e381d9200002812491 (patch)
treeb6293ee750b6198c593d33dffee2df7823947f89 /lib/dfatool.py
parentd2057ddd183163973613a6ce0be01fb656cc799d (diff)
calculate Spearman rank-order correlation coefficient
Diffstat (limited to 'lib/dfatool.py')
-rwxr-xr-xlib/dfatool.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/dfatool.py b/lib/dfatool.py
index 66be4fd..fcbac94 100755
--- a/lib/dfatool.py
+++ b/lib/dfatool.py
@@ -23,6 +23,14 @@ def is_numeric(n):
except ValueError:
return False
+def float_or_nan(n):
+ if n == None:
+ return np.nan
+ try:
+ return float(n)
+ except ValueError:
+ return np.nan
+
def append_if_set(aggregate, data, key):
if key in data:
aggregate.append(data[key])