Skip to content

Instantly share code, notes, and snippets.

Last active November 26, 2020 03:04
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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).
Copy link

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