manage nan in round_half_point
This commit is contained in:
parent
780a7c53af
commit
8eb8acd899
@ -8,11 +8,10 @@ from math import ceil
|
|||||||
# Values manipulations
|
# Values manipulations
|
||||||
|
|
||||||
def round_half_point(val):
|
def round_half_point(val):
|
||||||
|
try:
|
||||||
return 0.5 * ceil(2.0 * val)
|
return 0.5 * ceil(2.0 * val)
|
||||||
#try:
|
except ValueError:
|
||||||
# return 0.5 * ceil(2.0 * val)
|
return val
|
||||||
#except ValueError:
|
|
||||||
# return val
|
|
||||||
|
|
||||||
latex_caract = ["\\NoRep", "\\RepZ", "\\RepU", "\\RepD", "\\RepT"]
|
latex_caract = ["\\NoRep", "\\RepZ", "\\RepU", "\\RepD", "\\RepT"]
|
||||||
def note_to_rep(x):
|
def note_to_rep(x):
|
||||||
|
@ -12,6 +12,7 @@ def test_round_half_point():
|
|||||||
assert df_marks_manip.round_half_point(2.4) == 2.5
|
assert df_marks_manip.round_half_point(2.4) == 2.5
|
||||||
assert df_marks_manip.round_half_point(2.6) == 3
|
assert df_marks_manip.round_half_point(2.6) == 3
|
||||||
assert df_marks_manip.round_half_point(2.9) == 3
|
assert df_marks_manip.round_half_point(2.9) == 3
|
||||||
|
assert df_marks_manip.round_half_point(pandas.np.nan)
|
||||||
|
|
||||||
def test_note_to_rep():
|
def test_note_to_rep():
|
||||||
d = {"Niveau": 1, "Note": 0}
|
d = {"Niveau": 1, "Note": 0}
|
||||||
|
Loading…
Reference in New Issue
Block a user