You can use pandas iloc to select rows and columns by index. Here's an example that selects the 12th row and the 13th to 16th columns of a dataframe df:
main.py150 chars8 lines
Note that pandas uses zero-based indexing, so the 12th row has an index of 11. Also, when using iloc, the range of columns is inclusive of the first index and exclusive of the second index, so 12:16 selects the 13th to 16th column.
gistlibby LogSnag