This article mainly for you in detail the Python loading Excel error resolution method, with a certain reference value, interested in small partners can refer to
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 Loading Excel Error:
Indexerror:list index out of range
The reason is that there is a problem with the PELICANSTORES.XLSX format, and there are extra columns that are not displayed.
Open the file pelicanstores.xlsx with excle and copy the content to a new 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
[8 rows X columns]
In [55]: