type
Post
status
Published
date
Jul 5, 2024
slug
20240705105307
summary
使用pandas读入数据时,然后时用df.iloc[]报错索引超出范围
tags
Python
category
技术分享
icon
password
Index超出范围:
出现这个问题请仔细检查pandas在读入数据时,特别是CSV数据,是否使用了正确的分隔符。或者在数字矩阵前存在中文,导致读入数据的数据类型不对。从而导致无法正确识别列数和行数。
Unnamed:
Unnamed行或者列一般是由于全部读入数据是,存在完全的空行或者空列,这时只需要剔除即可。
NaN:
NaN值是个比较普遍的问题,所以pandas提供了专门的方法,和R语言中类似,使用dropna()方法即可。
- Author:Kecilimu
- URL:https://kecilimu-notion.vercel.app//article/20240705105307
- Copyright:All articles in this blog, except for special statements, adopt BY-NC-SA agreement. Please indicate the source!

