I've run into a
StopIteration: iteration not started error while trying to order a table using an update cursor.
Is this caused by zipping the cursor together? I've tried updating a different table that's identical to the one I ordered using a search cursor. The error persisted. There's not a lot of good information about this error so I've decided to write this question primarily as a reference for others who run into this problem.
Here's the code I'm running on a FileGeoDatabase for now
with arcpy.da.SearchCursor( in_table = copy_fc, field_names = fields, where_clause = "", sql_clause = (None, "order by DATE")) as ordered_cursor: sorted = [row for row in ordered_cursor] sorted_df = pd.DataFrame.from_records( data = sorted, columns = fields) print sorted_df.size fc = r"U:\R\A\qt\3.14159\;)" with arcpy.da.UpdateCursor(in_table = fc, field_names = fields)\ as cursor: for (row, item) in zip( cursor, building_sorted_df.itertuples(index = False)): row = item #Error happens on line below cursor.updateRow(row) print "Finished"
Please note, this is not a duplicate because I'm storing my values in a pandas data frame instead of trying to do pairwise iteration, my cursors are written correctly, and I'm not writing to a table while I'm reading from it.