I have a list that looks like this:
[['State', 'Gas', 'Air', 'Food', 'Party'],
['Alabama', 4802982, 9, 213068.0, 52419.02],
['Alaska', 721523, 3, 31618.0, 663267.26],
['Arizona', 6412700, 11, 144393.0, 113998.3],
['Arkansas', 2926229, 6, 209159.0, 53178.62],
['California', 37341989, 55, 394608.0, 163695.57],
['Colorado', 5044930, 9, 184289.0, 104093.57],
['Connecticut', 3581628, 7, 45744.0, 5543.33],
['Delaware', 900877, 3, 13849.0, 2489.27],
['District of Columbia', 0, 3, 3418.0, 68.34],
['Florida', 18900773, 29, 271024.0, 65754.59],
['Georgia', 9727566, 16, 271920.0, 59424.77],
['Hawaii', 1366862, 4, 9662.0, 10930.98],
['Idaho', 1573499, 4, 98649.0, 83570.08],
['Illinois', 12864380, 20, 305872.0, 57914.38]]
I want to create a list called total, which contains the sum of the data elements in this order: sum of states’ gas, sum of states’ air, sum of states’ food, and sum of states’ party. Obviously avoiding the column name list at the top of the list and also the states' names. I have tried multiple things, but this is what I think is leading me in the right direction so far:
total = [sum(x) for x in statesData[x]]