Skip to content

BUG: Don't transpose variables of one dimension #746

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

Merged
merged 1 commit into from
Feb 9, 2016
Merged

BUG: Don't transpose variables of one dimension #746

merged 1 commit into from
Feb 9, 2016

Conversation

max-sixty
Copy link
Collaborator

Resolves #745

A bit of a 'convenient hack'. Let me know if you think there's a better way to do this

@@ -647,6 +647,9 @@ def transpose(self, *dims):
"""
if len(dims) == 0:
dims = self.dims[::-1]
# no need to transpose if only one dimension
if len(dims) == 1:
return self
Copy link
Member

Choose a reason for hiding this comment

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

It's OK to keep the data the same, but we shouldn't return the same Variable object. I would use self.copy(deep=False) instead. Also, let's check after we verify that dims is valid (e.g., move the conditional one line below). Probably a little safer to use if self.ndim < 2 as the check instead, too.

@max-sixty
Copy link
Collaborator Author

Great, @shoyer, updated

@max-sixty
Copy link
Collaborator Author

Failing on this: pandas-dev/pandas#12235, will push again when resolved

@max-sixty
Copy link
Collaborator Author

@shoyer green

shoyer added a commit that referenced this pull request Feb 9, 2016
…pose

BUG: Don't transpose variables of one dimension
@shoyer shoyer merged commit 2ee2c65 into pydata:master Feb 9, 2016
@max-sixty max-sixty deleted the period-index-reset-on-transpose branch February 9, 2016 16:46
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.

2 participants