Data Access Module vs NumPy: Summarise Table

Discussion created by Playa on May 17, 2016
Latest reply on May 18, 2016 by Playa

I'd like to find out what approaches the community have used to achieve similar results using either:


  • Data Access Module or;
  • NumPy


The following table (stats_table1) is my starting point:



I'd like to populate a new table (stats_table2) based on the following structure:


for each row in the first table:


  • stats_table2 [SETTLEMENTNAME] = stats_table1 [SETTLEMENTNAME]
  • stats_table2 [SOCIAL_FACILITY] = stats_table1 [NAME]
  • stats_table2 [TIME0_15MIN] = stats_table1 (((TIME5 + TIME10 + TIME15)) / TOTALBUILD)*100)
  • stats_table2 [TIME15 _30MIN] = stats_table1 (((TIME20 + TIME25 + TIME30)) / TOTALBUILD)*100)
  • stats_table2 [TIME30 _60MIN] = stats_table1 ((TIME60 / TOTALBUILD)*100)
  • stats_table2 [TIME60_PLUS] = stats_table1 ((TIME60P / TOTALBUILD)*100)


Final Results:




Data Access Module:

  • Would you use a Search Cursor to loop through stats_table1, perform the following calculations and write the results to a python dictionary, then use a Update Cursor to populate stats_table2


  • Would you convert the stats_table1 to a NumPy array, perform the following calculations and write the results into a temporary array and and back to a table to be appended to stats_table2


Any sample code or references will be appreciated as I originally was looking at nesting a Search Cursor with a Update Cursor, then realised it was a bad idea.