Select by integer position | Explicit Syntax | Shorthand Convention |
---|---|---|
Single column from dataframe | df.iloc[:,3] | |
List of columns from dataframe | df.iloc[:,[3,5,6]] | |
Slice of columns from dataframe | df.iloc[:,3:7] | |
Single row from dataframe | df.iloc[20] | |
List of rows from dataframe | df.iloc[[0,3,8]] | |
Slice of rows from dataframe | df.iloc[3:5] | df[3:5] |
Single items from series | s.iloc[8] | s[8] |
List of item from series | s.iloc[[2,8,1]] | s[[2,8,1]] |
Slice of items from series | s.iloc[5:10] | s[5:10] |