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

Fix str and int comparison _custom_sort #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nienkevanunen
Copy link

Sorting Column B from the example was giving an error (TypeError: '<' not supported between instances of 'int' and 'str') as it contained both strings and integers. This change catches the error and instead converts all the values to string. Doing it only when one of the values is a string still allows proper digit comparisons when all values are digits (int/float).

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 this pull request may close these issues.

1 participant