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

CLN: fix core/algorithms.py dtype detection #15903

Closed
jreback opened this issue Apr 5, 2017 · 1 comment · Fixed by #15929
Closed

CLN: fix core/algorithms.py dtype detection #15903

jreback opened this issue Apr 5, 2017 · 1 comment · Fixed by #15929
Labels
Milestone

Comments

@jreback
Copy link
Contributor

jreback commented Apr 5, 2017

after this is merged: #15299

we have separate if/else detections for pretty much every routines, e.g. things like

if needs_i8_conversion:
    ....
elif .....

This is very smelly and needs to be refactored

#15902 instroduces _ensure_data to do this, but is restricted ATM to nlargest/nsamllest and needs integration.

Note that this is actually a bit tricky, because we actually want to return a bit more data, including a previously localized tz (for re-localization after).

@chris-b1
Copy link
Contributor

chris-b1 commented Apr 5, 2017

Maybe _ensure_data could also return a reconstruction function to handle the metadata. Something like

def unique(arr):
    arr, reconstructor = _ensure_data_view(arr)
    # labels, uniques = ....
    return labels, reconstructor(uniques) #handles Index, tz, Categorical

jreback added a commit to jreback/pandas that referenced this issue Apr 6, 2017
@jreback jreback mentioned this issue Apr 6, 2017
jreback added a commit that referenced this issue Apr 7, 2017
* CLN: clean up select_n algos

* CLN: clean ensure_data

closes #15903

* return ndtype, so can eliminate special cases

* unique

* fixups
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants