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]:

时间: 2024-10-21 17:33:52

python 加载excel报错的相关文章

kettle登录加载job 报错 Can't find Job 1

报错原因: Job 1是临时的新建job,我没保存数据库中,或本地文件,所以加载时找不到文件 解决方法: 目录C:\Documents and Settings\Administrator\.kettle\中有个.spoonrc文件 kettle启动会加载.spoonrc文件, 该文件中保存kettle的配置信息,包括启动时要加载哪些文件 删掉对应的 Job 1的键值对就行了,记得要调整相应键值计数. 我的环境中 tabfile1=Job 1 tabfile2=\u5237\u65B0\u5B9

dojo加载树报错

1.错误描述    error loading undefined children.    TypeError:this._arrayOfTopLevelItems is undefied. 2.错误原因 3.解决办法 dojo加载树报错

CentOS重新加载网卡报错 Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/23

重新加载网卡时出现的错误如下: 1 [[email protected] dev]# service network restart 2 Shutting down interface eth0: Device state: 3 (disconnected) 3 [ OK ] 4 Shutting down interface eth1: [ OK ] 5 Shutting down interface eth2: Device state: 3 (disconnected) 6 [ OK ]

加载模块报错:version magic '2.6.32-504.el6.i686 SMP mod_unload 686 ' should

在之前我也遇到这个问题,后来我解决了,但是当时没有记录下来,现在又遇到了,害我整了半天,所以现在记录下,供以后参考: 我开始的加载模块的时候报这样的错误: hello: module_layout: kernel tainted. Disabling lock debugging due to kernel taint hello: version magic '2.6.32-504.el6.i686 SMP mod_unload 686 ' should be '2.6.32-504.el6.

Unity3D 5.0版本 加载dll报错, 换用4.5 版本可以正确运行与导出(x86版本)

在Unity3D环境下测试UnityWebCore和awesomium等用来在Unity中显示网页的插件时, 发现总是不能加载dll文件. Win64环境, Unity5.0(64bit) 报错内容如下: Failed to load 'Assets/Plugins/awesomium.dll', expected 64 bit architecture (IMAGE_FILE_MACHINE_AMD64), but was IMAGE_FILE_MACHINE_I386. 网上的回答都是说该d

maven加载ojdbc14报错

问题复现步骤: 1.在pom.xml里面添加ojdbc14的依赖,代码如下: <dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc14</artifactId> <version>10.2.0.2</version></dependency> 2.执行mvn install报如下错误: [ERROR] Failed to execute goa

通过CImageList加载图标 报错

错误代码: <span style="white-space:pre"> </span><pre name="code" class="cpp"><span style="white-space:pre"> </span>CImageList m_ProcessImg ;//全局变量 必须声明为全局变量(.h文件中),否则无效 <span style="

eclipse 加载插件报错 org.eclipse.mylyn.java.tasks

在eclipse 中点按住Ctr 键的时候报以下这个错, The 'org.eclipse.mylyn.java.hyperlink.detector.stack' extension from plug-in 'org.eclipse.mylyn.java.tasks' to the 'org.eclipse.ui.workbench.texteditor.hyperlinkDetectors' extension point failed to load the hyperlink dete

KVM http网络加载镜像报错(mount: wrong fs type, bad option, bad superblock on /dev/loop0)

curl: (23) Failed writing body (7818 != 16384)loop: module loadeddracut-initqueue[579]: mount: wrong fs type, bad option, bad superblock on /dev/loop0dracut-initqueue[579]: missing codepage or helper program, or other errordracut-initqueue[579]: In s