Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# Multiple row and column selections using iloc and DataFrame
data.iloc[0:5] # first five rows of dataframe
data.iloc[:, 0:2] # first two columns of data frame with all rows
data.iloc[[0,3,6,24], [0,5,6]] # 1st, 4th, 7th, 25th row + 1st 6th 7th columns.
data.iloc[0:5, 5:8] # first 5 rows and 5th, 6th, 7th columns of data frame (county -> phone1).

This comment has been minimized.

Copy link

@dragz17 dragz17 commented Jun 2, 2018

How if like this.
I want to make x (row) in range 0:5 and 6:7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment