Hello

I have an attribute table describing butterfly range traits.

It is composed of three columns as below

Species name range size (X) latitude of range midpoint (Y)

There are 11 kinds of butterflies.

Each has its range size, and the latitude of each range midpoint ranges from 9 to 19.

I would like to have the average range size of every degree of latitude.

For example, the average range size of latitude degree 10 (10.0-10.99: Butterfly A2, B1, B2)

Please kindly help with python code to calculate the average values.

Thank you.

The details are as followed.

Butterfly A1 130.5 9.45

Butterfly A2 450.68 10.2

Butterfly A3 1102.38 9.3

Butterfly A4 893.34 16.4

Butterfly B1 820.2 10.54

Butterfly B2 872.2 10.87

Butterfly B3 488.2 16.79

Butterfly B4 620.11 18.3

Butterfly B5 982.78 12.98

Butterfly C1 720.32 12.67

Butterfly C2 912.2 18.07

I have an attribute table describing butterfly range traits.

It is composed of three columns as below

Species name range size (X) latitude of range midpoint (Y)

There are 11 kinds of butterflies.

Each has its range size, and the latitude of each range midpoint ranges from 9 to 19.

I would like to have the average range size of every degree of latitude.

For example, the average range size of latitude degree 10 (10.0-10.99: Butterfly A2, B1, B2)

Please kindly help with python code to calculate the average values.

Thank you.

The details are as followed.

Butterfly A1 130.5 9.45

Butterfly A2 450.68 10.2

Butterfly A3 1102.38 9.3

Butterfly A4 893.34 16.4

Butterfly B1 820.2 10.54

Butterfly B2 872.2 10.87

Butterfly B3 488.2 16.79

Butterfly B4 620.11 18.3

Butterfly B5 982.78 12.98

Butterfly C1 720.32 12.67

Butterfly C2 912.2 18.07

So potentially you would open a search cursor (or update cursor) on your input table, and 'nest' an insert cursor to write results in a new summary table. It's pretty standard type thing...mimicking, as I said, what Summary Statistics does. Your 'special case', though, is that you need a range of values for the case field of Summary Statistics, if you were to use that instead. That's why I suggested calculating a new field to code ranges, then run Summary Statistics on that.

Makes sense?