Arcpy to append results of pivot table

المشرف العام

Administrator
طاقم الإدارة
I have a script that does some processing but the main part are two things

  1. run a multiple ring buffer using arcpy.MultipleRingBuffer_analysis and four rings
  2. do some zonal statistics using arcpy.sa.ZonalStatisticsAsTable on the four rings
I do this repetitively (through a loop) so I want to dump the results to a table called Final Results. It makes sense to me to have the results organized in five columns (PatientID, Distance1, Distance2, Distance3, Distance4). I making my loop off a search cursor and keeping the PatientID.

I thought to create a pivot table using arcpy.PivotTable_management where the result becomes one row and five columns (the pivot variable and four buffers) and then push that to Final Results. However, it appears I would still need to create a search cursor for my pivot table, grab the first (and only) row, then create an insert cursor to put the data into my Final Resultstable.

Alternatively, I suppose I could just go to the table from #2 above, create a search cursor, and assign four variables (D1, D2, D3, D4) to the zonal stats results with some sort of switch-case statement, then create an insert cursor that concatenates D1, D2, D3, D4 and uses insert row.

Both seem rather inefficient.

Is there a smarter way to just push my results from zonal analysis into a table that I use?



أكثر...
 
أعلى