-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: clarify the behavior of the .as_matrix method #7413
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
Comments
This is a poorly named method. It's doing what it's intended to do, and for back compat reasons we can't change it. This corresponds to and I think is the implementation of the |
That's a bummer... I wanted to be able to do math on them elegantly. I'll see if I can clear that up in the docs. |
@clham Great! I'll reopen to track the doc issue. |
see long discussion on np.matrix here: http://comments.gmane.org/gmane.comp.python.numeric.general/56494 |
Thanks @jreback, My head exploded about halfway through that thread. Based on what I got through however, I'm guessing the consensus here is to frame the docs to reflect that |
whew wow that thread was interesting, thanks @jreback. personally, i've never once thought: "oh, i'll use |
Some things that could be improved in the docstring:
http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.as_matrix.html |
@cpcloud to the original point of the bug |
If you want a 2D Nx1 array, you can do So, in fact, a column does not return as a (1, N) array as you say, but as a (N, ) array, strictly speaking. |
as @jorisvandenbossche said, this yields an N-element vector. This is different from the semantics of a language like MATLAB, where there are no 1D arrays, everything is 2D even |
@clham Going to get to this soon? Otherwise I can put up a PR today... |
I'm working on it now. Docs are about the only thing I'm able to contribute! |
Nice! We'd gladly give you pointers and/or guidance if you want to tackle anything else! |
PR #7417 |
Closed by #7417 |
When using
df.as_matrix()
method, rows and columns do not render as 1xN or Nx1 matricies, rather as 1xN arrays.Expected :
The text was updated successfully, but these errors were encountered: