Skip to content

Instantly share code, notes, and snippets.

@marsja
Created October 10, 2019 07:12
Show Gist options
  • Save marsja/074ed7e1d2f0cd1cc3a35723280c7c7a to your computer and use it in GitHub Desktop.
Save marsja/074ed7e1d2f0cd1cc3a35723280c7c7a to your computer and use it in GitHub Desktop.
This gist is for an example code found in the blog post on how to use loc and iloc https://www.marsja.se/how-to-use-iloc-and-loc-for-indexing-and-slicing-pandas-dataframes/
import pandas as pd
data = 'https://vincentarelbundock.github.io/Rdatasets/csv/DAAG/nasshead.csv'
df = pd.read_csv(data, index_col=1)
df.loc['case']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment