From 2d8f3d37cbd9c5237502d896e2cd0df49ba6cc9f Mon Sep 17 00:00:00 2001 From: ChenXin Date: Sun, 6 Oct 2019 11:27:41 +0800 Subject: [PATCH] add an English hint in CSVLoader --- fastNLP/io/file_reader.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fastNLP/io/file_reader.py b/fastNLP/io/file_reader.py index 0c52655d..f1c90284 100644 --- a/fastNLP/io/file_reader.py +++ b/fastNLP/io/file_reader.py @@ -38,7 +38,8 @@ def _read_csv(path, encoding='utf-8', headers=None, sep=',', dropna=True): continue else: 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)) else: raise ValueError("Line {} has {} parts, while header has {} parts." \