AnsweredAssumed Answered

Calculate field using python to get most visited facility by area

Question asked by corey.stegall on Nov 29, 2019
Latest reply on Nov 29, 2019 by corey.stegall

Hello Everyone,

 

In arcgis pro, I have a feature class with an attribute table that contains fields with our facility names and the rows are census tracts.  The values are the number of visitors for each facility in each tract

               Facility1   Facility2   Facility3   etc            MostVisitedFacility <--Desired result field

Tract 1   1000         3000         2000                         Facility2 

Tract 2   2000         1000         4000                         Facility3 

.

One of my tasks is to determine the most visited facility in each tract. 

I can do this in Excel but I would like to work within ArcGIS Pro since the table is already in there.  Plus it would save me at least 5-10 minutes for every one of these I do. 

 

The way I do it in Excel is to use the max() function on each tract.  Then I use the match() function to determine the column number of the most visited facility.  Then I use the index() function to return the first row value of the column which is the facility name.

 

What is the python equivalent?  In my attempt to figure it out myself, I stumbled upon the SearchCursor function and ListFields function but I'm lost as to how to apply it or even if those are the appropriate functions.  Can someone point me in the right direction?

 

Thanks so much!

Outcomes