Skip to content

Commit

Permalink
add delimiter and decimal options to dev-add beliefs CLI command (#134)
Browse files Browse the repository at this point in the history
  • Loading branch information
nhoening committed May 19, 2021
1 parent 8e94505 commit bc01359
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions flexmeasures/data/scripts/cli_tasks/data_add.py
Expand Up @@ -287,6 +287,20 @@ def add_initial_structure():
type=int,
help="Column number with values (1 is 2nd column, the default)",
)
@click.option(
"--decimal",
required=False,
default=".",
type=str,
help="[For csv files] decimal character, e.g. '.' for 10.5",
)
@click.option(
"--delimiter",
required=True,
type=str,
default=",",
help="[For csv files] Character to delimit columns per row, defaults to comma",
)
@click.option(
"--sheet_number",
required=False,
Expand All @@ -304,6 +318,8 @@ def add_beliefs(
nrows: Optional[int] = None,
datecol: int = 0,
valuecol: int = 1,
decimal: str = ".",
delimiter: str = ",",
sheet_number: Optional[int] = None,
):
"""Add sensor data from a csv file (also accepts xls or xlsx).
Expand Down Expand Up @@ -340,6 +356,8 @@ def add_beliefs(
kwargs = dict()
if file.split(".")[-1].lower() == "csv":
kwargs["infer_datetime_format"] = True
kwargs["decimal"] = decimal
kwargs["delimiter"] = delimiter
if sheet_number is not None:
kwargs["sheet_name"] = sheet_number
if horizon is not None:
Expand Down

0 comments on commit bc01359

Please sign in to comment.