diff --git a/documentation/changelog.rst b/documentation/changelog.rst index 1f0e990b5..bd74e5fe4 100644 --- a/documentation/changelog.rst +++ b/documentation/changelog.rst @@ -11,6 +11,7 @@ New features ----------- * Three new CLI commands for cleaning up your database: delete 1) unchanged beliefs, 2) NaN values or 3) a sensor and all of its time series data [see `PR #328 `_] * Add CLI option to pass a data unit when reading in time series data from CSV, so data can automatically be converted to the sensor unit [see `PR #341 `_] +* Add CLI option to specify custom strings that should be interpreted as NaN values when reading in time series data from CSV [see `PR #357 `_] * Add CLI commands ``flexmeasures add sensor``, ``flexmeasures add asset-type``, ``flexmeasures add beliefs`` (which were experimental features before). [see `PR #337 `_] * Add CLI commands for showing data [see `PR #339 `_] * Add CLI command for attaching annotations to assets: ``flexmeasures add holidays`` adds public holidays [see `PR #343 `_] diff --git a/flexmeasures/cli/data_add.py b/flexmeasures/cli/data_add.py index b3f56588d..bdac4e41a 100755 --- a/flexmeasures/cli/data_add.py +++ b/flexmeasures/cli/data_add.py @@ -358,6 +358,12 @@ def add_initial_structure(): type=int, help="Number of rows to skip from the top. Set to >1 to skip additional headers.", ) +@click.option( + "--na-values", + required=False, + multiple=True, + help="Additional strings to recognize as NaN values. This argument can be given multiple times.", +) @click.option( "--nrows", required=False, @@ -415,6 +421,7 @@ def add_beliefs( resample: bool = True, allow_overwrite: bool = False, skiprows: int = 1, + na_values: List[str] = None, nrows: Optional[int] = None, datecol: int = 0, valuecol: int = 1, @@ -478,6 +485,7 @@ def add_beliefs( nrows=nrows, usecols=[datecol, valuecol], parse_dates=True, + na_values=na_values, **kwargs, ) if unit is not None: