calacule feild

219
3
12-29-2021 03:14 AM
Labels (1)
matu89
by
New Contributor II

hey,

i want to calculate the average value of these 5 rows and ther result will be wrriten in the Group_AVerage

can someone help with this calculation ?

image :

Capture111.PNG

 

thanks..

0 Kudos
3 Replies
ABishop
Regular Contributor III

I would love to help, but this makes no sense.

Amanda Bishop, GISP
0 Kudos
DanPatterson
MVP Esteemed Contributor

Amanda, they are looking to calculate a "moving block mean", which is like a running mean but you increment the sliding/moving window by a value > 1

from numpy.lib.stride_tricks import sliding_window_view as sw
a = np.arange(1, 11)
a
array([ 1,  2,  3,  4,  5,  6,  7,  8,  9, 10])

a0 = sw(a, 5)
a1 = sw(a, 5)[::5, :]

a0.mean(axis=-1)
array([3., 4., 5., 6., 7., 8.])

a1.mean(axis=-1)
array([3., 8.])

so you would have to create the array outside Pro using TableToNumPyArray

There is little point bringing back the results into an existing table, but you could generate a results array and bring it back using NumPyArrayToTable.

An interesting but pointless venture at this stage


... sort of retired...
JayantaPoddar
MVP Esteemed Contributor

If you would like to interactively select the rows, and define their mean value, then

After selecting rows, right-click on the "numeric" field whose mean value you want to calculate > Statistics.

JayantaPoddar_0-1640787948239.png

Copy the desired value, and define it to the Group_Average field using Calculate Field.

__________________________________________________________________________________________________

In case you have a field based on which you can categorize the groups,

1. Dissolve the table based on the category field. For Statistics Field parameters, define the numeric field . Statistics Type=Mean.

2. Then use Join Field to join the Mean_<Value> field to your original Attribute Table based on the Category Field.



Think Location