Skip to content

Instantly share code, notes, and snippets.

@Riyasharma-in
Last active March 31, 2023 16:59
Show Gist options
  • Save Riyasharma-in/0157b7ea19229c9b90119ec8d6977647 to your computer and use it in GitHub Desktop.
Save Riyasharma-in/0157b7ea19229c9b90119ec8d6977647 to your computer and use it in GitHub Desktop.
Sorting and Automate Adjustment
# re-order the bounding boxes by their position
for i in range(len(bboxes)-1):
for ind in range(len(df)-1):
if df.iloc[ind][4] > df.iloc[ind+1][0] and df.iloc[ind][1] > df.iloc[ind+1][1]:
#print(df.iloc[ind][4] , df.iloc[ind+1][0] , df.iloc[ind][1] , df.iloc[ind+1][1])
df.iloc[ind], df.iloc[ind+1] = df.iloc[ind+1].copy(), df.iloc[ind].copy()
#print(df.iloc[ind], df.iloc[ind+1],'')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment