In [1]:
%load_ext sql

In [10]:
%sql sqlite:///2016.db


Out[10]:
u'Connected: None@2016.db'

In [17]:
%sql select count(distinct orispl_code) as num_plants, fuel_type, SUM(heat_input), SUM(CO2_MASS) from data group by fuel_type


Done.
Out[17]:
num_plants fuel_type SUM(heat_input) SUM(CO2_MASS)
44 Coal 1828294021.68 190078286.186
14 Natural Gas 113287674.599 6733549.711
1 Natural Gas, Pipeline Natural Gas 182723.201 10859.063
1 Other Gas 27517565.063 1624003.463
195 Pipeline Natural Gas 1373820199.42 81557792.797
1 Wood 5528270.88 576296.4

In [16]:
%sql select count(distinct orispl_code) as num_plants, fuel_type, SUM(heat_input), SUM(CO2_MASS) from data group by fuel_type, state


Done.
Out[16]:
num_plants SUM(heat_input) SUM(CO2_MASS) fuel_type
42 1828294021.68 190078286.186 Coal
14 113287674.599 6733549.711 Natural Gas
1 182723.201 10859.063 Natural Gas, Pipeline Natural Gas
1 27517565.063 1624003.463 Other Gas
192 1373820199.42 81557792.797 Pipeline Natural Gas
1 5528270.88 576296.4 Wood

In [ ]: