Index of about python

I wrote a few days program, deeply felt python language (especially numpy, pandas) for powerful data indexing capabilities. Hereby summarize:

iloc and loc difference
https://www.cnblogs.com/ghllfl/p/8481576.html

loc: row by row index tag data
Example LOC [n] denotes an index of the n-th row (index integer)

LOC [ 'd'] denotes an index of the first 'd' line (index character)

iloc: data acquisition line by line number, not a character

ix: the combination of the first two hybrid index

Between the three types:

ix / loc may be performed by row and row labels index numbers, such df.loc [ 'A'], df.loc [. 1], df.ix [ 'A'],
df.ix [. 1]

Iloc only through the row number index, df.iloc [0] is, while df.iloc [ 'a'] is wrong

Recommendation: When the line number of the index, as far as possible with iloc to index; and label index when using loc, ix try not to use.

Guess you like

Origin blog.51cto.com/14421854/2415764