jupyter notebook如何导入excel数据

您所在的位置:网站首页 excel如何打开xlsx文件 jupyter notebook如何导入excel数据

jupyter notebook如何导入excel数据

2023-09-18 20:10| 来源: 网络整理| 查看: 265

项目场景:

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文件



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3