Skip to content

ENH: squeeze - lower dimensionaility of a structure by removing exactly len 1 dims #2544

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

Closed
jreback opened this issue Dec 16, 2012 · 1 comment
Labels
Enhancement Ideas Long-Term Enhancement Discussions

Comments

@jreback
Copy link
Contributor

jreback commented Dec 16, 2012

like numpy.sqeeze but returns the correct pandas object

add in core/generic?

anyone like squash better?

(prob a fair number of special cases where need to check, e.g. empty Series)...
so propose for 0.11

def squeeze(self):
    """ squeeze length 1 dimensions """
    return self.ix[tuple([ a[0] if len(a) ==  1 else slice(None)  for a in self.axes ])]
@jreback
Copy link
Contributor Author

jreback commented Jan 23, 2013

close by PR #2734

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Ideas Long-Term Enhancement Discussions
Projects
None yet
Development

No branches or pull requests

1 participant