Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong indice sorting #118

Closed
vincentsarago opened this issue Oct 6, 2020 · 0 comments · Fixed by #119
Closed

Wrong indice sorting #118

vincentsarago opened this issue Oct 6, 2020 · 0 comments · Fixed by #119

Comments

@vincentsarago
Copy link
Member

indices, _ = zip(*sorted(zip(indices, int_pcts), reverse=True))

indices = (0, 1, 2, 3, 4, 5, 6)                                                                                                                             
int_pcts = (0, 2, 3, 1, 6, 5, 7)

# Current in cogeo-mosaic                                                                                                                          
sorted_idx, sorted_pct = zip(*sorted(zip(indices, int_pcts), reverse=True))                                                                                            
print(sorted_idx)                                                                                                                                                 
>>> (6, 5, 4, 3, 2, 1, 0)
print(sorted_pct)
>>> (7, 5, 6, 1, 3, 2, 0)

# What we expected 
sorted_pct, sorted_idx = zip(*sorted(zip(int_pcts, indices), reverse=True))
print(sorted_idx)                                                                                                                                                 
>>> (6, 4, 5, 2, 1, 3, 0)
print(sorted_pct)
>>> (7, 6, 5, 3, 2, 1, 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant