[SciPy-User] [SciPy-user] ValueError: arrays must have same number of dimensions
Thu Jun 28 12:03:19 CDT 2012
Thanks for the clarification Tony!
Tony Yu-3 wrote:
> On Thu, Jun 28, 2012 at 12:49 PM, surfcast23 <firstname.lastname@example.org> wrote:
>> Hi sanGuziy,
>> That did it. Thank you! can you explain why it worked for future
> Hi Khary,
> Two points:
> 1) `concatenate` doesn't know which direction you want to concatenate in
> (this is the `axis` argument Jorge metioned)
> 2) `concatenate` expects arrays of the same dimension (in your example, v
> is 1D and k is 2D), so if you're adding rows to an array, those arrays
> have the same number of columns (v had no columns b/c it was an N-array,
> which is different than an N x 1, column array).
> Instead of `concatenate` you could use `vstack`: `np.vstack([v, k])`
> The "v" in `vstack` means "vertical" here; there's also `hstack` and
> `dstack` (horizontal and depth). `vstack` is nice because you don't have
> broadcast your input `v` to a column vector (as you did with
> SciPy-User mailing list
View this message in context: http://old.nabble.com/ValueError%3A-arrays-must-have-same-number-of-dimensions-tp34086886p34087396.html
Sent from the Scipy-User mailing list archive at Nabble.com.
More information about the SciPy-User