简体   繁体   English

熊猫列索引在iloc中有所不同

[英]Pandas column indexing differ in iloc

what is the difference between the two below code 下面的两个代码有什么区别

my_data.iloc[:,2:3]

&

my_data.iloc[:,2]

why the result differ eventhough it seems same? 为什么结果看起来一样,但结果却不同?

One output DataFrame another one is return Series 一个输出DataFrame另一个输出DataFrame Series

type(df.iloc[2:3])
<class 'pandas.core.frame.DataFrame'>
type(df.iloc[2])
<class 'pandas.core.series.Series'>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM