df manip in bareme
This commit is contained in:
parent
9d9a80686e
commit
dcc6dc7334
@ -37,13 +37,14 @@ def tranform_scale(eval_df, new_scale, method):
|
|||||||
:returns: the transformed eval_df
|
:returns: the transformed eval_df
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
df = eval_df.copy()
|
||||||
for c in ["Bareme", "Mark", "Mark_barem"]:
|
for c in ["Bareme", "Mark", "Mark_barem"]:
|
||||||
try:
|
try:
|
||||||
eval_df[c+"_old"]
|
df[c+"_old"]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
eval_df[c+"_old"] = eval_df[c]
|
df[c+"_old"] = df[c]
|
||||||
|
|
||||||
eval_df["Bareme"] = new_scale
|
df["Bareme"] = new_scale
|
||||||
|
|
||||||
TRANFS = {"min": new_scale_min,
|
TRANFS = {"min": new_scale_min,
|
||||||
"prop": new_scale_proportionnal,
|
"prop": new_scale_proportionnal,
|
||||||
@ -51,12 +52,12 @@ def tranform_scale(eval_df, new_scale, method):
|
|||||||
try:
|
try:
|
||||||
t = TRANFS[method]
|
t = TRANFS[method]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
eval_df["Mark"] = eval_df.apply(method)
|
df["Mark"] = df.apply(method)
|
||||||
else:
|
else:
|
||||||
eval_df["Mark"] = eval_df.apply(t, axis=1)
|
df["Mark"] = df.apply(t, axis=1)
|
||||||
|
|
||||||
eval_df["Mark_barem"] = compute_mark_barem(eval_df)
|
df["Mark_barem"] = compute_mark_barem(df)
|
||||||
return eval_df
|
return df
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user