Similar to this post (ArcGIS median value from a layer) I am looking for a toolbox to get the median value for a data field by a case. For example, say I have dataset with percent tree cover for each county for each state; I would like to summarize the data by calculating the median percent forest cover by state.

When you get a chance be sure to Accept your Answer to your own Question which is quite permissible to do and encouraged in such cases.
–
PolyGeo♦Jul 4 '13 at 2:25

1

I cannot recall the source of the original code, but the length of the CASE field is based on the assumption that the layer is a shapefile, which only supports field names up to 11 characters long. If you want to allow longer field names (in a geodatabase), you can easily modify this by removing the constraints towards the beginning of the code that truncates the field names to a max length, such as outCaseField = cI[:10], outCaseField = caseFields[:10], and outMedField = "MED_" + statField[:5].
–
RyanDaltonJul 4 '13 at 3:57

By the way, nice work on this and thanks for translating the code to 10.x using ArcPy.
–
RyanDaltonJul 4 '13 at 3:59

Thanks Ryan, happy to do it.@PolyGeo thanks for the information. I will accept later on today.
–
Pat JohnsonJul 4 '13 at 14:11

thanks for the answer Ryan, and for the initial work you did on creating the toolbox. I had made the changes you suggested, but it still didn't work. I read elsewhere that I should check capitalization because some functions became case-sensitive (e.g gp.addmessage becomes arcpy.AddMessage). That didn't get it to work either. I can give it another look tomorrow and if I get working I will post the script here. That is if it's alright by you, since you wrote it.
–
Pat JohnsonJul 2 '13 at 23:21