Skip to content

Commit

Permalink
fix: replace NaNs before storing results
Browse files Browse the repository at this point in the history
  • Loading branch information
nextchamp-saqib committed Nov 5, 2024
1 parent ae7347b commit a5b5294
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions insights/insights/doctype/insights_query/insights_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from functools import cached_property

import frappe
import numpy as np
import pandas as pd
from frappe import _dict
from frappe.model.document import Document
from frappe.utils import flt
Expand Down Expand Up @@ -218,6 +220,8 @@ def fetch_results(self, additional_filters=None):
def update_query_results(self, results=None):
results = results or []
query_result: Document = InsightsQueryResult.get_or_create_doc(query=self.name)
results = pd.DataFrame(results).replace({pd.NaT: None, np.nan: None})
results = results.to_dict(orient="records")
query_result.update(
{
"results": frappe.as_json(results),
Expand Down

0 comments on commit a5b5294

Please sign in to comment.