Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions sdmxthon/parsers/data_validations.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import re
from copy import copy
from datetime import datetime

import numpy as np
Expand Down Expand Up @@ -562,10 +563,10 @@ def process_errors_by_column(data, dsd, errors, k, man_codes, grouping_keys,
is_numeric = False

data_column = data[k].unique().astype('str')

float_column = copy(data_column)
if 'TimePeriod' not in types[k]:
try:
data_column = data_column.astype('float64')
float_column = data_column.astype('float64')
is_numeric = True
except (TypeError, ValueError):
pass
Expand All @@ -581,7 +582,7 @@ def process_errors_by_column(data, dsd, errors, k, man_codes, grouping_keys,
if k in man_codes:
control = False
if is_numeric:
if np.isnan(np.sum(data_column)):
if np.isnan(np.sum(float_column)):
control = True
else:
if 'nan' in data_column:
Expand All @@ -602,7 +603,7 @@ def process_errors_by_column(data, dsd, errors, k, man_codes, grouping_keys,
if k in faceted:
facets = faceted[k]
if is_numeric:
errors += check_num_facets(facets, data_column, k, role)
errors += check_num_facets(facets, float_column, k, role)
else:
errors += check_str_facets(facets, data_column, k, role)

Expand Down