import numpy as np
import pandas as pd
inputfile = 'D:\软件\python\《Python数据分析与挖掘实战(张良均等)》中文PDF+源代码\《Python数据分析与挖掘实战(张良均等)》中文PDF+源代码\数据及代码\chapter13\demo\data\datal.csv'
date=pd.read_csv(inputfile)
r = [data.min(), data.max(), data.mean(), data.std()] # 依次计算最小值、最大值、均值、标准差
r = pd.DataFrame(r, index=['Min', 'Max', 'Mean', 'STD']).T # 计算相关系数矩阵
np.round(r, 2) # 保留两位小数
运行如下:
C:\Users\86186\Anaconda3\python.exe D:/软件/python/《Python数据分析与挖掘实战(张良均等)》中文PDF+源代码/《Python数据分析与挖掘实战(张良均等)》中文PDF+源代码/数据及代码/chapter13/demo/code/13-1_gaikuo.py
Traceback (most recent call last):
File "D:/软件/python/《Python数据分析与挖掘实战(张良均等)》中文PDF+源代码/《Python数据分析与挖掘实战(张良均等)》中文PDF+源代码/数据及代码/chapter13/demo/code/13-1_gaikuo.py", line 5, in
date=pd.read_csv(fileinput)
File "C:\Users\86186\Anaconda3\lib\site-packages\pandas\io\parsers.py", line 655, in parser_f
return read(filepath_or_buffer, kwds)
File "C:\Users\86186\Anaconda3\lib\site-packages\pandas\io\parsers.py", line 405, in _read
parser = TextFileReader(filepath_or_buffer, **kwds)
File "C:\Users\86186\Anaconda3\lib\site-packages\pandas\io\parsers.py", line 764, in __init_
self._make_engine(self.engine)
File "C:\Users\86186\Anaconda3\lib\site-packages\pandas\io\parsers.py", line 985, in make_engine
self._engine = CParserWrapper(self.f, **self.options)
File "C:\Users\86186\Anaconda3\lib\site-packages\pandas\io\parsers.py", line 1605, in __init_
self._reader = parsers.TextReader(src, **kwds)
File "pandas/_libs/parsers.pyx", line 394, in pandas._libs.parsers.TextReader.__cinit__ (pandas_libs\parsers.c:4209)
File "pandas/_libs/parsers.pyx", line 710, in pandas._libs.parsers.TextReader._setup_parser_source (pandas_libs\parsers.c:8873)
FileNotFoundError: File b'D:\\xe8\xbd\xaf\xe4\xbb\xb6\python\\xe3\x80\x8aPython\xe6\x95\xb0\xe6\x8d\xae\xe5\x88\x86\xe6\x9e\x90\xe4\xb8\x8e\xe6\x8c\x96\xe6\x8e\x98\xe5\xae\x9e\xe6\x88\x98(\xe5\xbc\xa0\xe8\x89\xaf\xe5\x9d\x87\xe7\xad\x89)\xe3\x80\x8b\xe4\xb8\xad\xe6\x96\x87PDF+\xe6\xba\x90\xe4\xbb\xa3\xe7\xa0\x81\\xe3\x80\x8aPython\xe6\x95\xb0\xe6\x8d\xae\xe5\x88\x86\xe6\x9e\x90\xe4\xb8\x8e\xe6\x8c\x96\xe6\x8e\x98\xe5\xae\x9e\xe6\x88\x98(\xe5\xbc\xa0\xe8\x89\xaf\xe5\x9d\x87\xe7\xad\x89)\xe3\x80\x8b\xe4\xb8\xad\xe6\x96\x87PDF+\xe6\xba\x90\xe4\xbb\xa3\xe7\xa0\x81\\xe6\x95\xb0\xe6\x8d\xae\xe5\x8f\x8a\xe4\xbb\xa3\xe7\xa0\x81\chapter13\demo\data\datal.csv' does not exist
Process finished with exit code 1