I am building a model to calculate geometric mean for each shape file in model builder. How to do write Expression and Code Block which would:

Take in shapefile "City_1" and use all the values in Field "Area" and calculate n√a*b*c*d. ..... where n are number of values in field "Area" and a,b,c,d are all the value in field "Area"

the first example is a code block (def gm(a) ), just substitute your field name in the expression call …. gm(!YourFieldName!) … using a python parser.

The last one can be turned into a code block

import scipy.stats as st

def gm(a):

"""scipy version"""

areas = st.gmean(areas)

return areas

gm(!YourFieldName!)

This is the link to Calculate values to show you where to put stuff

Calculate Value—Tools | ArcGIS Desktop