Fix embarrassing arithmetic bug

This commit is contained in:
Aarni Koskela
2021-02-22 14:18:42 +02:00
parent b75edb5dc3
commit cce673801f

View File

@@ -101,7 +101,7 @@ def force_age_numeric(df):
for cat in df["Ikä"].cat.categories:
m = re.match("^(\d+)-(\d+) v", cat)
if m:
age_map[cat] = int(round(float(m.group(1)) + float(m.group(2)) / 2))
age_map[cat] = int(round(float(m.group(1)) + float(m.group(2))) / 2)
df["Ikä"] = df["Ikä"].apply(lambda r: age_map.get(r, r))
return df