Summary statistics on attribute table

I've got a polygon feature class with attributes fields `y2010`, `y2011`, `y2012`, `y2013`, `y2014`, `country`

The 'year' fields contain counts of an event occurrence, which can be 0 or > 0. The 'country' field' is an identifier for country A or B, so the table looks like this:

``````y2010 | y2011 | y2012 | y2013 | y2014 | country

0  |  10    |   1   |   0   |   5   |   A
1  |   0    |   3   |   0   |   5   |   A
0  |   1    |   1   |  45   |  20   |   B
``````

I'd like to reformat this table to show per year the number of features that fit certain criteria. The criteria are:

1. More than zero event occurrences for countries A+B;
2. More than 1 event occurrences for countries A+B;
3. More than zero event occurrences for country A.

so that the final table using the example above would looks like:

``````criterium | 2010 | 2011 | 2012 | 2013 | 2014 |
1           1      2      3      1     3
2           0      1      1      1     3
3           1      1      2      0     2
``````

and the table content of columns 2:6 would be the number of features of the original table, that meet the criterium for that specific year.

I've been toying around with the Statistics toolset, but so far without success. Any tips are welcome.

Edit: Opted for Q&D solution by exporting the attribute table to R and wrote a script to calculate the cell values.

• Will your table only every have 2 countries? Aug 6, 2014 at 13:59
• Yes, the expected output is correct. Thanks for edit. As it is now, my data has 4 different countries, but I'm only interested in 2 options: country A or NOT country A. Aug 6, 2014 at 14:10

So you need to be looking at the help file at how to use `arcpy`'s `SelectLayerByAttribute_management()`, `GetCount_management()` and `InsertCursor()` (ArcGIS 10.0 or earlier) or `da.InsertCursor()` (ArcGIS 10.1+) functions to achieve this.