In [4]:
import csv
In [11]:
with open('coal_plants.csv', 'rb') as csvfile:
reader = csv.DictReader(csvfile)
epa = []
cems = []
for row in reader:
epa.append(row['\xef\xbb\xbfORIS Code'])
cems.append(row[' Facility ID (ORISPL)'])
print("Things in EPA, not in CEMS")
for entry in epa:
if entry not in cems:
print(entry)
print("Things in CEMS, not in EPA")
for entry in cems:
if entry not in epa:
print(entry)
In [15]:
import sqlite3
import pandas
con = sqlite3.connect('navajo.db')
table = pandas.read_sql('select * from data', con)
table.to_csv('output.csv')
In [16]:
%load_ext sql
In [18]:
%sql sqlite:///navajo.db
%sql select * from data limit 0
Out[18]:
In [30]:
%sql select max(CAST(gload as float)) as global_max_generation, max(CAST(heat_input as float)) as global_max_heat_input, name, orispl_code, unitid from data group by name, unitid
Out[30]:
In [ ]: