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 structured array Nitram 3 177 Sep-17-2019, 10:09 PM
Last Post: jefsummers
  Simple numpy reshape error wih contour3D AdeIsHere 0 110 Sep-17-2019, 12:01 PM
Last Post: AdeIsHere
  Numpy arrays and compatability with Fortran arrays merrittr 0 145 Sep-03-2019, 03:54 AM
Last Post: merrittr
  import numpy in sub-files paul18fr 1 189 Aug-06-2019, 12:38 PM
Last Post: chakrimakam
  Converting set of tuples to set of 2D numpy arrays ThemePark 0 169 Aug-04-2019, 05:07 PM
Last Post: ThemePark
  Trying to replace for loops with numpy vspoloni 8 646 Aug-04-2019, 07:09 AM
Last Post: paul18fr
  Add column to numpy matrix Gigux 1 209 Aug-02-2019, 12:05 AM
Last Post: scidam
  Python/C API Matrix to Numpy jibarra 0 150 Jul-29-2019, 03:25 PM
Last Post: jibarra
  Error installing numpy srm 3 472 Jul-08-2019, 06:26 PM
Last Post: srm
  AttributeError: module 'numpy' has no attribute 'array aapurdel 7 2,930 May-29-2019, 02:48 AM
Last Post: heiner55

Forum Jump:

Users browsing this thread: 1 Guest(s)