From e8c4688c84e5b4e1bf12860b513ed4a7b95ea45c Mon Sep 17 00:00:00 2001 From: Felix Claessen <30658763+Flix6x@users.noreply.github.com> Date: Tue, 20 Jun 2023 13:06:11 +0200 Subject: [PATCH] fix: drop NaN values when saving the report to the database (#735) * fix: drop NaN values when saving the report to the database Signed-off-by: F.N. Claessen * docs: changelog entry Signed-off-by: F.N. Claessen * docs: explain abbreviation Signed-off-by: F.N. Claessen * docs: CLI changelog entry Signed-off-by: F.N. Claessen --------- Signed-off-by: F.N. Claessen --- documentation/changelog.rst | 1 + documentation/cli/change_log.rst | 5 +++++ flexmeasures/cli/data_add.py | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/documentation/changelog.rst b/documentation/changelog.rst index 77c9d88d9..c2c485c92 100644 --- a/documentation/changelog.rst +++ b/documentation/changelog.rst @@ -25,6 +25,7 @@ Bugfixes ----------- * Relax constraint validation of `StorageScheduler` to accommodate violations caused by floating point precision [see `PR #731 `_] +* Avoid saving any :abbr:`NaN (not a number)` values to the database, when calling ``flexmeasures add report`` [see `PR #735 `_] * Fix browser console error when loading asset or sensor page with only a single data point [see `PR #732 `_] diff --git a/documentation/cli/change_log.rst b/documentation/cli/change_log.rst index acf7f739a..97fb419ea 100644 --- a/documentation/cli/change_log.rst +++ b/documentation/cli/change_log.rst @@ -9,6 +9,11 @@ since v0.15.0 | July XX, 2023 * Allow deleting multiple sensors with a single call to ``flexmeasures delete sensor`` by passing the ``--id`` option multiple times. +since v0.14.1 | June XX, 2023 +================================= + +* Avoid saving any :abbr:`NaN (not a number)` values to the database, when calling ``flexmeasures add report``. + since v0.14.0 | June 15, 2023 ================================= diff --git a/flexmeasures/cli/data_add.py b/flexmeasures/cli/data_add.py index f5c44f708..9f288cf02 100755 --- a/flexmeasures/cli/data_add.py +++ b/flexmeasures/cli/data_add.py @@ -1347,10 +1347,10 @@ def add_report( # noqa: C901 "Report computation done, but the report is empty.", **MsgStyle.WARN ) - # save the report it's not running in dry mode + # save the report if it's not running in dry mode if not dry_run: click.echo("Saving report to the database...") - save_to_db(result) + save_to_db(result.dropna()) db.session.commit() click.secho( "Success. The report has been saved to the database.",