Skip to content
Snippets Groups Projects
Verified Commit c60a6b16 authored by Yannick DAYER's avatar Yannick DAYER
Browse files

fix(scores): pandas to read score column as float.

When loading a score file, indicate to pandas to interpret the score
column as float (prevent issues when the first elements are empty).
parent 7717a1b9
Branches
Tags
1 merge request!328Scores loading fixes
...@@ -9,6 +9,7 @@ import logging ...@@ -9,6 +9,7 @@ import logging
import os import os
import tarfile import tarfile
from collections import defaultdict
from pathlib import Path from pathlib import Path
import dask.dataframe import dask.dataframe
...@@ -162,7 +163,9 @@ def get_split_dataframe(filename): ...@@ -162,7 +163,9 @@ def get_split_dataframe(filename):
:ref:`bob.bio.base.pipeline_simple_advanced_features`) :ref:`bob.bio.base.pipeline_simple_advanced_features`)
""" """
df = dask.dataframe.read_csv(filename) df = dask.dataframe.read_csv(
filename, dtype=defaultdict(lambda: str, {"score": float})
)
genuines = df[df.probe_subject_id == df.bio_ref_subject_id] genuines = df[df.probe_subject_id == df.bio_ref_subject_id]
impostors = df[df.probe_subject_id != df.bio_ref_subject_id] impostors = df[df.probe_subject_id != df.bio_ref_subject_id]
...@@ -195,7 +198,9 @@ def split_csv_scores(filename, score_column: str = "score"): ...@@ -195,7 +198,9 @@ def split_csv_scores(filename, score_column: str = "score"):
:ref:`bob.bio.base.pipeline_simple_advanced_features`) :ref:`bob.bio.base.pipeline_simple_advanced_features`)
""" """
df = dask.dataframe.read_csv(filename) df = dask.dataframe.read_csv(
filename, dtype=defaultdict(lambda: str, {"score": float})
)
genuines = df[df.probe_subject_id == df.bio_ref_subject_id] genuines = df[df.probe_subject_id == df.bio_ref_subject_id]
impostors = df[df.probe_subject_id != df.bio_ref_subject_id] impostors = df[df.probe_subject_id != df.bio_ref_subject_id]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment