Last active
November 15, 2019 10:04
-
-
Save shanealynn/b27fbdce4688f06108a32c767b65fc3f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Select rows with index values 'Andrade' and 'Veness', with all columns between 'city' and 'email' | |
data.loc[['Andrade', 'Veness'], 'city':'email'] | |
# Select same rows, with just 'first_name', 'address' and 'city' columns | |
data.loc['Andrade':'Veness', ['first_name', 'address', 'city']] | |
# Change the index to be based on the 'id' column | |
data.set_index('id', inplace=True) | |
# select the row with 'id' = 487 | |
data.loc[487] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great!