Skip to content

Instantly share code, notes, and snippets.

@debonx
Created November 1, 2018 15:38
Show Gist options
  • Save debonx/bddedc822e9d3376ae3b334b90ab8b46 to your computer and use it in GitHub Desktop.
Save debonx/bddedc822e9d3376ae3b334b90ab8b46 to your computer and use it in GitHub Desktop.
Using Pandas library example. More at https://pandas.pydata.org/
import pandas as pd
#Read CSV file
orders = pd.read_csv('shoefly.csv')
#Inspect first 5 lines
print(orders.head(5))
#Get a specific serie of data / column
emails = orders['email']
#select a specific order by colum
frances_palmer = orders[(orders.first_name == 'Frances') & (orders.last_name == 'Palmer')]
#select a specific order by value
comfy_shoes = orders[orders.shoe_type.isin(['clogs', 'boots', 'ballet flats'])]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment