jupyter notebook导入excel数据:
看了相关文档,excel文件test首先保存到jupyter notebook工作目录下,打开jupyter notebook,建立新的代码:
import numpy as np
import pandas as pd
features = pd.read_xlsx('test.xlsx')
print(features)
运行,会出现:
D:\Anaconda\setup\lib\site-packages\pandas\__init__.py in __getattr__(name)
256 return _SparseArray
257
--> 258 raise AttributeError(f"module 'pandas' has no attribute '{name}'")
259
260
AttributeError: module 'pandas' has no attribute 'read_xlsx'
搜了搜,猜是文件命名问题,不对,后面估计是文件格式保存不对
将test.xlsx另存为test.csv格式,会出现想要结果:
应该是pands只能识别.csv文件