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

Sort broken after unique -> Series with object array #1807

Closed
jseabold opened this issue Aug 23, 2012 · 4 comments
Closed

Sort broken after unique -> Series with object array #1807

jseabold opened this issue Aug 23, 2012 · 4 comments
Labels

Comments

@jseabold
Copy link
Contributor

I have no idea why this fails.

pandas.Series(pandas.Series(["a","c","b"]).unique()).sort()

but this doesn't

pandas.Series(np.array(["a", "c", "b"], dtype=object)).sort()
@changhiskhan
Copy link
Contributor

the unique method in hashtable sets the base to be something other than an ndarray.
@wesm is setting uniques.base necessary? I have it setup locally right now so sort checks whether base is an instance of ndarray, but if uniques.base isn't necessary I'll just get rid of those in hashtable.pyx and we should be good to go.

@wesm
Copy link
Member

wesm commented Aug 24, 2012

Well, the issue is ownership of the data buffer. I think there is a way to transfer ownership of the buffer that doesn't require setting uniques.base. See http://gael-varoquaux.info/blog/?p=157 (this is where I got the method from that I'm using as I recall)(

@wesm
Copy link
Member

wesm commented Sep 4, 2012

Having a look at this. If you resize the databuffer and manually set the array flags to own the data, it should work

@wesm wesm closed this as completed in dbfdb07 Sep 4, 2012
@wesm
Copy link
Member

wesm commented Sep 4, 2012

alrighty all set now, was fairly simple actually

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

No branches or pull requests

3 participants