我正在运行一个处理30,000个类似文件的程序.随机数量正在停止并产生此错误......
File "C:\Importer\src\dfman\importer.py", line 26, in import_chr
data = pd.read_csv(filepath, names=fields)
File "C:\Python33\lib\site-packages\pandas\io\parsers.py", line 400, in parser_f
return _read(filepath_or_buffer, kwds)
File "C:\Python33\lib\site-packages\pandas\io\parsers.py", line 205, in _read
return parser.read()
File "C:\Python33\lib\site-packages\pandas\io\parsers.py", line 608, in read
ret = self._engine.read(nrows)
File "C:\Python33\lib\site-packages\pandas\io\parsers.py", line 1028, in read
data = self._reader.read(nrows)
File "parser.pyx", line 706, in pandas.parser.TextReader.read (pandas\parser.c:6745)
File "parser.pyx", line 728, in pandas.parser.TextReader._read_low_memory (pandas\parser.c:6964)
File "parser.pyx", line 804, in pandas.parser.TextReader._read_rows (pandas\parser.c:7780)
File "parser.pyx", line 890, in pandas.parser.TextReader._convert_column_data (pandas\parser.c:8793)
File "parser.pyx", line 950, in pandas.parser.TextReader._convert_tokens …
Run Code Online (Sandbox Code Playgroud) pandas函数read_csv()读取.csv文件.它的文档在这里
根据文件,我们知道:
dtype:列的类型名称或字典 - > type,default无数据或列的数据类型.例如{'a':np.float64,'b':np.int32}(不支持engine ='python')
和
converter:dict,default无用于转换某些列中的值的函数的字典.键可以是整数或列标签
使用此功能时,我可以调用
pandas.read_csv('file',dtype=object)
或pandas.read_csv('file',converters=object)
.显然,转换器,它的名字可以说数据类型将被转换,但我想知道dtype的情况?