Skip to content

Commit

Permalink
fix: filter null values for summary stats
Browse files Browse the repository at this point in the history
closes #158
  • Loading branch information
alee committed Nov 30, 2021
1 parent 05e7e12 commit 0642daf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/store/stats.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { format, std, mean, median } from "mathjs";
import { format, std, mean, median, filter } from "mathjs";

const EMPTY_SUMMARY_STATISTICS = {
stdDev: "N/A",
Expand All @@ -15,7 +15,7 @@ const DEFAULT_PRECISION = 2;
* @returns {stdDev, mean, median} over the given timeSeries
*/
export function summarize(timeSeries) {
const values = timeSeries.y;
const values = filter(timeSeries.y, (x) => x !== null);
if (values.length === 0) {
return EMPTY_SUMMARY_STATISTICS;
}
Expand Down

0 comments on commit 0642daf

Please sign in to comment.