Suggest column types ignores nulls, closes #94

This commit is contained in:
Simon Willison 2020-03-23 12:57:02 -07:00
commit 1c745df923
2 changed files with 8 additions and 1 deletions

View file

@ -13,7 +13,8 @@ def suggest_column_types(records):
all_column_types = {}
for record in records:
for key, value in record.items():
all_column_types.setdefault(key, set()).add(type(value))
if value is not None:
all_column_types.setdefault(key, set()).add(type(value))
column_types = {}
for key, types in all_column_types.items():
if len(types) == 1: