问题描述
最近开始从我的安全地方(R)分支到Python,并且对 Pandas
中的单元格定位/选择有些困惑.我已经阅读了文档,但仍在努力了解各种本地化/选择选项的实际含义.
Recently began branching out from my safe place (R) into Python and and am a bit confused by the cell localization/selection in Pandas
. I've read the documentation but I'm struggling to understand the practical implications of the various localization/selection options.
我是否有理由在 at
和 iat
上使用 .loc
或 .iloc
或相反亦然?在什么情况下应该使用哪种方法?
Is there a reason why I should ever use .loc
or .iloc
over at
, and iat
or vice versa? In what situations should I use which method?
推荐答案
loc:仅适用于索引
iloc:在位置上进行工作
at :获取标量值.这是一个非常快速的位置
iat :获取标量值.这是一个非常快的iloc
loc: only work on index
iloc: work on position
at: get scalar values. It's a very fast loc
iat: Get scalar values. It's a very fast iloc
还
http://pyciencia.blogspot.com/2015/05/obtener-y-filtrar-datos-de-un-dataframe.html
这篇关于pandas loc vs. iloc vs. at vs. iat?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!