import arcpy arcpy.env.overwriteOutput = True pipesFC = r'C:\Testing\outputs\test.shp' minMax = r'in_memory\table' stats = [['Elevation', 'MIN'],['Elevation','MAX']] arcpy.Statistics_analysis(pipesFC, minMax, stats,'Pipe_ID') # Generate dictionary to hold pipe ID min/max elevations val_dict = {} with arcpy.da.SearchCursor(minMax, ['Pipe_ID','MIN_Elevation','MAX_Elevation']) as rows: for row in rows: val_dict[row[0]] = [row[1],row[2]] # Update records in table with arcpy.da.UpdateCursor(pipesFC,['Pipe_ID','DownElv','UpElv']) as rows: for row in rows: if row[0] in val_dict: down = val_dict[row[0]][0] up = val_dict[row[0]][1] row[1] = down row[2] = up rows.updateRow(row) print 'done'
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.