python加载excel报错解决方法
from pandas import Series, DataFrame
import pandas as pd
import numpy as np
import os
import sys
reload(sys)
sys.setdefultencoding('utf-8')
file1=pd.read_excel('F:/dataanalysis/statistics/PelicanStores.xlsx')
Python 加载excel报错:
IndexError: list index out of range
原因是PelicanStores.xlsx 的格式有问题,有未显示的多余列。
用excle打开文件PelicanStores.xlsx, 把内容复制到一个新的excel-PelicanStoresnew即可以。
file1=pd.read_excel('F:/dataanalysis/statistics/PelicanStoresnew.xlsx')
file1
Out[54]:
Customer Type of Customer Items Net Sales Method of Payment Gender 0 1 Regular 1 39.50 Discover Male
1 2 Promotional 1 102.40 Proprietary Card Female
2 3 Regular 1 22.50 Proprietary Card Female
3 4 Promotional 5 100.40 Proprietary Card Female
4 5 Regular 2 54.00 MasterCard Female
5 6 Regular 1 44.50 MasterCard Female
6 7 Promotional 2 78.00 Proprietary Card Female
[100 rows x 8 columns]
In [55]:
以上就是python加载excel报错解决方法的详细内容,更多请关注其它相关文章!
上一篇: wp8.1 Study8:页面过渡和主题动画(Page transition and Theme animations)_html/css_WEB-ITnose
下一篇: php.exe 程序直接请求url
推荐阅读
-
Python首次安装后运行报错(0xc000007b)的解决方法
-
Python首次安装后运行报错(0xc000007b)的解决方法
-
POI导出Excel报错No such file or directory的解决方法
-
Python运行报错UnicodeDecodeError的解决方法
-
Visual studio 2017添加引用时报错未能正确加载ReferenceManagerPackage包的解决方法
-
Python安装Imaging报错:The _imaging C module is not installed问题解决方法
-
Visual studio 2017添加引用时报错未能正确加载ReferenceManagerPackage包的解决方法
-
Python运行报错UnicodeDecodeError的解决方法
-
Pycharm下载pyinstaller报错:You should consider upgrading via the 'python -m pip install --upgrade pip' command的解决方法
-
Pycharm下载pyinstaller报错:You should consider upgrading via the 'python -m pip install --upgrade pip' command的解决方法