df manip in bareme

This commit is contained in:
Benjamin Bertrand 2017-03-14 08:10:46 +03:00
parent 9d9a80686e
commit dcc6dc7334

View File

@ -37,13 +37,14 @@ def tranform_scale(eval_df, new_scale, method):
:returns: the transformed eval_df
"""
df = eval_df.copy()
for c in ["Bareme", "Mark", "Mark_barem"]:
try:
eval_df[c+"_old"]
df[c+"_old"]
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,
"prop": new_scale_proportionnal,
@ -51,12 +52,12 @@ def tranform_scale(eval_df, new_scale, method):
try:
t = TRANFS[method]
except KeyError:
eval_df["Mark"] = eval_df.apply(method)
df["Mark"] = df.apply(method)
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)
return eval_df
df["Mark_barem"] = compute_mark_barem(df)
return df