Python loading Excel Error resolution method

Source: Internet
Author: User
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]:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.