Browse Source

add an English hint in CSVLoader

tags/v0.5.0
ChenXin 5 years ago
parent
commit
2d8f3d37cb
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      fastNLP/io/file_reader.py

+ 2
- 1
fastNLP/io/file_reader.py View File

@@ -38,7 +38,8 @@ def _read_csv(path, encoding='utf-8', headers=None, sep=',', dropna=True):
continue continue
else: else:
if "" in headers: if "" in headers:
raise ValueError(" 数据{}有{}个字段, 但header有{}个字段. 请检查header中的空白字段或多余的'{}'" \
raise ValueError(("Line {} has {} parts, while header has {} parts.\n" +
"Please check the empty parts or unnecessary '{}'s in header.")
.format(line_idx, len(contents), len(headers), sep)) .format(line_idx, len(contents), len(headers), sep))
else: else:
raise ValueError("Line {} has {} parts, while header has {} parts." \ raise ValueError("Line {} has {} parts, while header has {} parts." \


Loading…
Cancel
Save