- # Change:
- change = round(float(last - trend) / 1000000, 2)
- # Relative change:
- rel_change = int(relative_change(float(trend), float(last)))
-
- tbl_lst.append([name,
- round(float(last) / 1000000, 2),
- change,
- rel_change,
- anomaly])
+
+ if not isnan(last) and not isnan(trend) and trend != 0:
+ # Change:
+ change = round(float(last - trend) / 1000000, 2)
+ # Relative change:
+ rel_change = int(relative_change(float(trend), float(last)))
+
+ tbl_lst.append([name,
+ round(float(last) / 1000000, 2),
+ change,
+ rel_change,
+ anomaly])