我一直在使用熊猫有一段时间了,我明白了什么loc
和iloc
做。但是直到今天,我都不知道这两件事是否代表某种意义?他们是某种缩写还是缩写?还是只是随机的?
我将其解释iloc
为“基于索引的位置”,这很有意义,但loc
对我来说有点问题,我将其解释为“位置”,但没有喊出“基于标签的位置”,为什么他们不能称之为“基于标签的位置” lloc
?
To properly answer your question, as you are asking "Does loc
and iloc
stand for anything?" and not What is the difference between loc
and iloc
?.
I've done some research, and found from this github issue which lead me to this summary. And from these docs, I believe this sums up with these statements
Different Choices for Indexing
Object selection has had a number of user-requested additions in order to support more explicit location based indexing.
.loc
: is primarily label based.iloc
: is primarily integer position basedAnd on the chance we want to include
ix
.ix
supports mixed integer and label based access. It is primarily label based, but will fall back to integer positional access continue
Selection By Label
pandas provides a suite of methods in order to have purely label based indexing... - continued
- The
.loc
attribute is the primary access method. ?
Selection By Position
pandas provides a suite of methods in order to get purely integer based indexing... - continued
- The
.iloc
attribute is the primary access method. ?
This does also apply to .at
and .iat
as well.
Similarly to
loc
,at
provides label based scalar lookups, while,iat
provides integer based lookups analogously toiloc
I personally like how I said it in my comment but I will elaborate
It doesn't seem like there is a concrete correlating abreviation symantically or in the docs; other than it really just lamens "location" vs "integer location". Human Readable Labels vs Computer Logical Indexing. It happens for everyone, especially with new or complicated languages or ideoligies; where you know what something does and how to use it, but it's unsettling when you try to rationalize it's meaning or sort of explain or talk yourself through it.
Seems that's a Pythonista's nightmare and dream all in one. - (Me)
顺便说一句,我撤回了我的近距离投票,并给了你赞成票,因为那确实需要一些勇气来对已经被问到的话题进行更多的澄清,但是我也知道我在学习时也遇到了问题。希望这可以帮助
归档时间: |
|
查看次数: |
816 次 |
最近记录: |