Need to import agate before starting
In [23]:
import agate
Create agate Table from Leaking tanks csv file
In [24]:
spills = agate.Table.from_csv('fliteredlustclean.csv')
Check out column names & types from salaries table
In [25]:
print(spills)
Let's group by owner
In [26]:
by_owner = spills.group_by('OWNCO--------------------')
Let's see owners totals
In [27]:
owner_totals = by_owner.aggregate([
('count', agate.Length())
])
Let's find the worst offenders
In [28]:
sorted_totals = owner_totals.order_by('count', reverse=True)
Print the top 20 offenders
In [29]:
sorted_totals.print_table(max_rows=20)
In [ ]: