Skip to content

DOC: clarify the behavior of the .as_matrix method #7413

Closed
@clham

Description

@clham

When using df.as_matrix() method, rows and columns do not render as 1xN or Nx1 matricies, rather as 1xN arrays.

In [4]: df.ix['foo']=[5,3]

In [5]: df.ix['bar']=[2,6]

In [6]: df
Out[6]:
     A  B
foo  5  3
bar  2  6

[2 rows x 2 columns]

In [7]: df['A'].as_matrix()
Out[7]: array([ 5.,  2.])

In [8]: df.ix['foo'].as_matrix()
Out[8]: array([ 5.,  3.])

Expected :

In [9]: np.matrix('5; 2')
Out[9]:
matrix([[5],
        [2]])

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions