Skip to content

Commit

Permalink
CLI option to specify strings that are to be interpreted as NaN values (
Browse files Browse the repository at this point in the history
#357)

* CLI option to specify strings that are to be interpreted as NaN values

Signed-off-by: F.N. Claessen <felix@seita.nl>

* Changelog entry

Signed-off-by: F.N. Claessen <felix@seita.nl>
  • Loading branch information
Flix6x committed Feb 3, 2022
1 parent 9aed012 commit f6f5b17
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions documentation/changelog.rst
Expand Up @@ -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 <http://www.github.com/FlexMeasures/flexmeasures/pull/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 <http://www.github.com/FlexMeasures/flexmeasures/pull/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 <http://www.github.com/FlexMeasures/flexmeasures/pull/357>`_]
* Add CLI commands ``flexmeasures add sensor``, ``flexmeasures add asset-type``, ``flexmeasures add beliefs`` (which were experimental features before). [see `PR #337 <http://www.github.com/FlexMeasures/flexmeasures/pull/337>`_]
* Add CLI commands for showing data [see `PR #339 <http://www.github.com/FlexMeasures/flexmeasures/pull/339>`_]
* Add CLI command for attaching annotations to assets: ``flexmeasures add holidays`` adds public holidays [see `PR #343 <http://www.github.com/FlexMeasures/flexmeasures/pull/343>`_]
Expand Down
8 changes: 8 additions & 0 deletions flexmeasures/cli/data_add.py
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit f6f5b17

Please sign in to comment.