same isnan problem as in data_utils

isnan will TypeError on strings, so check more carefully. This time use the flexible_isnan added to data_utils