Fix: bug on score_rate parsing

This commit is contained in:
Bertrand Benjamin 2019-08-04 23:32:22 +02:00
parent 358af2aabf
commit e9a8310f15
3 changed files with 21 additions and 17 deletions

View File

@ -69,6 +69,10 @@ def flat_clear_csv(csv_df, no_student_columns=NO_ST_COLUMNS.values()):
.replace(VALIDSCORE["NOANSWER"], -1) .replace(VALIDSCORE["NOANSWER"], -1)
.apply(lambda x: str(x).replace(",", ".")) .apply(lambda x: str(x).replace(",", "."))
) )
df[COLUMNS["score_rate"]] = pd.to_numeric(
df[COLUMNS["score_rate"]]
.apply(lambda x: str(x).replace(",", "."))
)
return df return df

View File

@ -64,18 +64,18 @@ def report(csv_file):
), ),
) )
with open(csv_file.parent / "description.yml") as f: # with open(csv_file.parent / "description.yml") as f:
tribe_desc = yaml.load(f, Loader=yaml.FullLoader) # tribe_desc = yaml.load(f, Loader=yaml.FullLoader)
template = Path(config["templates"]) / "tpl_student.ipynb" # template = Path(config["templates"]) / "tpl_student.ipynb"
dest = Path(config["output"]) / tribe / csv_filename / "students" # dest = Path(config["output"]) / tribe / csv_filename / "students"
dest.mkdir(parents=True, exist_ok=True) # dest.mkdir(parents=True, exist_ok=True)
for st in tribe_desc["students"]: # for st in tribe_desc["students"]:
click.echo(f"Building {st} report on {assessment}") # click.echo(f"Building {st} report on {assessment}")
pm.execute_notebook( # pm.execute_notebook(
str(template), # str(template),
str(dest / f"{st}.ipynb"), # str(dest / f"{st}.ipynb"),
parameters=dict(tribe=tribe, student=st, source=str(tribe_dir.absolute())), # parameters=dict(tribe=tribe, student=st, source=str(tribe_dir.absolute())),
) # )

File diff suppressed because one or more lines are too long