Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 numpy.copy / numpy.delete
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)

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


Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  numpy.append() in Python ankushshah 1 95 Nov-08-2019, 06:18 AM
Last Post: ThomasL
  memory issue loading movie to numpy array djf123 1 79 Nov-07-2019, 06:19 AM
Last Post: ThomasL
  Numpy structured array Nitram 3 244 Sep-17-2019, 10:09 PM
Last Post: jefsummers
  Simple numpy reshape error wih contour3D AdeIsHere 0 166 Sep-17-2019, 12:01 PM
Last Post: AdeIsHere
  Numpy arrays and compatability with Fortran arrays merrittr 0 194 Sep-03-2019, 03:54 AM
Last Post: merrittr
  import numpy in sub-files paul18fr 1 239 Aug-06-2019, 12:38 PM
Last Post: chakrimakam
  Converting set of tuples to set of 2D numpy arrays ThemePark 0 320 Aug-04-2019, 05:07 PM
Last Post: ThemePark
  Trying to replace for loops with numpy vspoloni 8 938 Aug-04-2019, 07:09 AM
Last Post: paul18fr
  Add column to numpy matrix Gigux 1 399 Aug-02-2019, 12:05 AM
Last Post: scidam
  Python/C API Matrix to Numpy jibarra 0 204 Jul-29-2019, 03:25 PM
Last Post: jibarra

Forum Jump:

Users browsing this thread: 1 Guest(s)