Browse Source

allow rows to contain less data than columns suggest

pull/861/head
Christian Gill 4 years ago
parent
commit
78d7575886
1 changed files with 3 additions and 3 deletions
  1. 6
      app/api/utils.py

6
app/api/utils.py

@ -385,10 +385,10 @@ class ExcelParser(FileParser):
yield data
data = []
# Only text column
if len(row) == len(columns) and len(row) == 1:
data.append({'text': row[0]})
if len(row) <= len(columns) and len(row) == 1:
data.append({'text': row[0] })
# Text, labels and metadata columns
elif len(row) == len(columns) and len(row) >= 2:
elif len(row) <= len(columns) and len(row) >= 2:
datum = dict(zip(columns, row))
text, label = datum.pop('text'), datum.pop('label')
meta = FileParser.encode_metadata(datum)

Loading…
Cancel
Save