Skip to content

Transpose method not working with pandas dataframes #13330

Closed
@ghost

Description

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]])

Metadata

Metadata

Assignees

No one assigned

    Labels

    Compatpandas objects compatability with Numpy or Python functions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions