Python Forum

Full Version: numpy.copy / numpy.delete
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Dear All

I tried to copy a part of an array/matrix using numpy.copy; my first reaction was to write:
n = 10;
A = np.random.random( (n,5) );
B = np.copy(A[:, 0:3]);
Nevertheless it does not work (single vector is obtained): how to proceed?

Thanks for your advice(s)

Paul
I got ... stupid error
It works perfect, maybe the result only doesn´t match your expectations?
But first, Python is not Javascript, so forget using the ; at the end of the lines.

np.copy(A[0, 0:3]) gives you the first three elements of the first row of A
so that is definitly a single vector.

What do you expect that it should return?
yes it works; I've found my (stupid) error but I've been unable to supress the post.

In any way thanks for your interest

Paul