python中pandas读取csv文件出现的问题
之前做数据训练使用pandas导入.csv数据集的时候出现了如下问题:
Traceback (most recent call last):
File "pandas\_libs\parsers.pyx", line 1050, in pandas._libs.parsers.TextReader._convert_tokens
TypeError: Cannot cast array data from dtype('O') to dtype('float64') according to the rule 'safe'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:/software/Python/project/bp-pso/particle_network.py", line 345, in <module>
TRAIN, TEST = load_data('./data/DataSec.csv')
File "c:/software/Python/project/bp-pso/particle_network.py", line 313, in load_data
df = pd.read_csv(filename, header=None, dtype=float)
File "c:\software\Python\project\bp-pso\venv\lib\site-packages\pandas\io\parsers.py", line 610, in read_csv
return _read(filepath_or_buffer, kwds)
File "c:\softwa