From 78b916c3a7470d741f1361af2a7e01d99525c486 Mon Sep 17 00:00:00 2001 From: mantao Date: Tue, 28 Jul 2020 04:44:28 +0000 Subject: [PATCH] fix bug --- plot_gen.py | 11 ++++------- tabler/index.html | 11 ++++++----- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/plot_gen.py b/plot_gen.py index 6720fba..99a5abb 100644 --- a/plot_gen.py +++ b/plot_gen.py @@ -1,5 +1,6 @@ from datetime import datetime from datetime import timezone +import numpy class TimeSeriesAccumulator: @@ -26,19 +27,15 @@ class TimeSeriesAccumulator: result = [] for i in self.data: new = f(i) - if new == numpy.nan: + if numpy.isnan(new): result.append(prev) else: result.append(new) prev = new return result - -return [f(i) for i in self.data] - - -def get_ts(self): - return [datetime.utcfromtimestamp(self.start_timestamp+(i+1)*self.bin_time) for i in range(self.n_bins)] + def get_ts(self): + return [datetime.utcfromtimestamp(self.start_timestamp+(i+1)*self.bin_time) for i in range(self.n_bins)] if __name__ == "__main__": diff --git a/tabler/index.html b/tabler/index.html index 240ef34..c5a593b 100644 --- a/tabler/index.html +++ b/tabler/index.html @@ -430,9 +430,9 @@ @@ -601,4 +602,4 @@ - \ No newline at end of file +