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

Handle range on heterogeneously typed Dataset column #2345

Merged
merged 3 commits into from
Feb 19, 2018
Merged

Conversation

philippjfr
Copy link
Member

Calling range on a heterogeneously typed column currently causes all kinds of issues (including errors) due to python 3 sorting semantics. While range should generally not be called on object or string dtype columns it currently is so this needs to work robustly for the time being. Therefore this PR uses the python2sort utility to do the sorting robustly in python3.

@philippjfr philippjfr added type: bug Something isn't correct or isn't working tag: component: data labels Feb 15, 2018
@jlstevens
Copy link
Contributor

This is one semantic change in Python 3 that I find to be downright annoying. Anyway, the suggested fix makes sense.

dimensions = [dataset.get_dimensions(d).name for d in dimensions]
inds = [dataset.data.columns.index(dim.name) for dim in dimensions]
return dataset.data.values[:, inds]

Copy link
Contributor

@jlstevens jlstevens Feb 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't quite see how this relates to the python 2 vs 3 sorting issue. Is this method implementating an unrelated fix?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, accidentally pushed this. Will revert.

@philippjfr philippjfr force-pushed the hetero_ds_range branch 2 times, most recently from bf5ea1b to 92d9e35 Compare February 19, 2018 00:05
@philippjfr
Copy link
Member Author

Going to need rebuilt test data, but let's get #1978 merged first since that also requires new test data.

@jlstevens
Copy link
Contributor

Happy to merge when the tests go green.

@jlstevens jlstevens merged commit d05358f into master Feb 19, 2018
@philippjfr philippjfr deleted the hetero_ds_range branch February 20, 2018 03:35
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
tag: component: data type: bug Something isn't correct or isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants