Skip to content

Commit 1fb60e4

Browse files
authored
Catch typeerror in new row synthesis query (#234)
1 parent 315e34a commit 1fb60e4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

sdmetrics/single_table/new_row_synthesis.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,15 @@ def compute(cls, real_data, synthetic_data, metadata=None, numerical_match_toler
100100

101101
row_filter.append(field_filter)
102102

103-
matches = real_data.query(' and '.join(row_filter))
103+
try:
104+
matches = real_data.query(' and '.join(row_filter))
105+
except TypeError:
106+
if len(real_data) > 10000:
107+
warnings.warn('Unable to optimize query. For better formance, set the '
108+
'`synthetic_sample_size` parameter or upgrade to Python 3.8')
109+
110+
matches = real_data.query(' and '.join(row_filter), engine='python')
111+
104112
if matches is None or matches.empty:
105113
num_unique_rows += 1
106114

0 commit comments

Comments
 (0)