Skip to content

Transpose method not working with pandas dataframes #13330

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
ghost opened this issue May 31, 2016 · 3 comments
Closed

Transpose method not working with pandas dataframes #13330

ghost opened this issue May 31, 2016 · 3 comments
Labels
Compat pandas objects compatability with Numpy or Python functions

Comments

@ghost
Copy link

ghost commented May 31, 2016

Under Ubuntu 16, I am getting the following:

>>> import pandas as pd
>>> import numpy as np
>>> a = np.array([[1, 2], [3, 4]])
>>> a = pd.DataFrame(a)
>>> a
   0  1
0  1  2
1  3  4
>>> np.transpose(a)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "....../anaconda2/lib/python2.7/site-packages/numpy/core/fromnumeric.py", line 551, in transpose
    return transpose(axes)
TypeError: transpose() takes exactly 1 argument (2 given)
>>> a.T
   0  1
0  1  3
1  2  4
>>> np.transpose(a.as_matrix())
array([[1, 3],
       [2, 4]])
@jreback
Copy link
Contributor

jreback commented May 31, 2016

this was fixed in 0.18.1; though you should simply use a.T.

@jreback jreback closed this as completed May 31, 2016
@jreback jreback added the Compat pandas objects compatability with Numpy or Python functions label May 31, 2016
@jreback
Copy link
Contributor

jreback commented May 31, 2016

xref #12810

@hemangjoshi37a
Copy link

Still not working a.T
please help...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Compat pandas objects compatability with Numpy or Python functions
Projects
None yet
Development

No branches or pull requests

2 participants