Skip to content

Commit

Permalink
Avoid division by 0
Browse files Browse the repository at this point in the history
  • Loading branch information
akariv committed Jun 9, 2024
1 parent 3dbed03 commit aada5c3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion odds/backend/processor/resource_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ async def process(self, resource: Resource, dataset: Dataset, catalog: DataCatal
values = [row[col_name] for row in data]
true_values = [x for x in values if x is not None]
field.sample_values = [str(x) for x, _ in Counter(values).most_common(10)]
field.missing_values_percent = int(100 * (len(values) - len(true_values)) / len(values))
if len(values) > 0:
field.missing_values_percent = int(100 * (len(values) - len(true_values)) / len(values))
if field.data_type in ('number', 'integer', 'date', 'time', 'datetime'):
try:
field.max_value = str(max(true_values))
Expand Down

0 comments on commit aada5c3

Please sign in to comment.