2017-10-17 31 views
-4

我'与Python新手系数增加的错误,我虽然机器学习脚本运行error raised by iloc function的Python:通过ILOC功能

得到一个错误,我试图了解这个问题的原因,所以我在similair搜索并阅读有关iloc功能。 有人可以帮我理解这个错误的可能原因,以及我如何恢复它。

在此先感谢

+2

大,所以你显示的错误。但是你的代码呢?数据?预期结果?对不起,但我们无法想象你的问题陈述。 –

+1

错误是明显的,你传递了一个出界索引值,此外,如果这是'然后pandas'适当地标记问题 – EdChum

+0

@EdChum我怎么能恢复这个问题 – AKMN

回答

0

您可以在调用iloc与不存在的指数引发此错误documentation看到。

dfl = pd.DataFrame(np.random.randn(5,2), columns=list('AB')) 

dfl.iloc[[4, 5, 6]] 
IndexError: positional indexers are out-of-bounds 

dfl.iloc[:, 4] 
IndexError: single positional indexer is out-of-bounds