[Numpy-discussion] ndarray.T2 for 2D transpose

Matthew Brett matthew.brett at gmail.com
Thu Apr 7 14:21:46 EDT 2016

On Thu, Apr 7, 2016 at 11:17 AM, Chris Barker <chris.barker at noaa.gov> wrote:
> On Thu, Apr 7, 2016 at 10:00 AM, Ian Henriksen
> <insertinterestingnamehere at gmail.com> wrote:
>> Here's another example that I've seen catch people now and again.
>> A = np.random.rand(100, 100)
>> b =  np.random.rand(10)
>> A * b.T
> typo? that was supposed to be
> b =  np.random.rand(100). yes?
> This is exactly what someone else referred to as the expectations of someone
> that comes from MATLAB, and doesn't yet "get" that 1D arrays are 1D arrays.
> All of this is EXACTLY the motivation for the matric class -- which never
> took off, and was never complete (it needed a row and column vector
> implementation, if you ask me. But Ithikn the reason it didn't take off is
> that it really isn't that useful, but is different enough from regular
> arrays to be a greater source of confusion. And it was decided that all
> people REALLY wanted was an obviou sway to get matric multiply, which we now
> have with @.
> So this discussion brings up that we also need an easy an obvious way to
> make a column vector --
> maybe:
> np.col_vector(arr)
> which would be a synonym for np.reshape(arr, (-1,1))

Yes, I was going to suggest `colvec` and `rowvec`.


More information about the NumPy-Discussion mailing list