Runtime error Traceback (most recent call last): File "<string>", line 23, in <module> TypeError: sequence size must match size of the row
import arcpy, collections from arcpy import env env.workspace = r"C:\Users\cc1\Desktop\NEW.gdb\WAYNE" table = "WAYNE" table2 = arcpy.CreateTable_management("in_memory", "WAYNE") arcpy.AddField_management(table2, "SOS_VOTERID","TEXT", field_length=25) arcpy.AddField_management(table2, "FEAT_SEQ","LONG") newList = {row[0]: row[1] for row in arcpy.da.SearchCursor(table, ["SOS_VOTERID","FEAT_SEQ"])} tbl = arcpy.ListTables("*") for table in tbl: fieldList = arcpy.ListFields(table) for field in fieldList: newList.append([table,field.name]) # this populates the new list with table and field to directly insert to new table with arcpy.da.InsertCursor(table2, ['SOS_VOTERID', 'FEAT_SEQ']) as insert: for f in newList: insert.insertRow(f) del insert
Solved! Go to Solution.
valueDict = {r[0]:[r[1],r[2]] for r in arcpy.da.SearchCursor(myFC, ["OID@","ID","NAME"])} #add/calc a new "field" that is float(OID - 1) * OID for key in valueDict: valueDict[key].append(float(key -1) * key)