Skip to content

Instantly share code, notes, and snippets.

@hunterowens
Created July 16, 2015 19:51
Show Gist options
  • Save hunterowens/c9735359b17a4113c538 to your computer and use it in GitHub Desktop.
Save hunterowens/c9735359b17a4113c538 to your computer and use it in GitHub Desktop.
CA Pipeline Operators
# coding: utf-8
import pandas as pd
# Get the table by id, pick first item on the returned list
df = pd.read_html('http://primis.phmsa.dot.gov/comm/reports/operator/OperatorIM_opid_300.html?nocache=6511#_Incidents_tab_3', attrs={'id': '_4E112845Q'})[0]
# only in CA
df[df['State'] == 'CA'].keys()
# Sort by property damage
df[df['State'] == 'CA'].sort('PropertyDamage (A) ')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment