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 diagonal davidm 1 348 Aug-02-2020, 01:09 AM
Last Post: scidam
  Cycle through Numpy range within another range(?) Zero01 0 306 Jul-31-2020, 02:37 PM
Last Post: Zero01
  How to compare two json and write to third json differences with pandas and numpy onenessboy 0 356 Jul-24-2020, 01:56 PM
Last Post: onenessboy
  Adding data in 3D array from 2D numpy array asmasattar 0 322 Jul-23-2020, 10:55 AM
Last Post: asmasattar
  Numpy doesn't work in Spyder 4.1.3 player1681 1 271 Jun-02-2020, 11:26 AM
Last Post: jefsummers
  import numpy problem ptnb 1 390 May-18-2020, 06:03 PM
Last Post: ptnb
  'numpy.ndarray' object is not callable ato_cr 1 3,171 May-12-2020, 08:12 AM
Last Post: anbu23
  cv2/numpy d8a988 4 356 Apr-29-2020, 03:37 PM
Last Post: d8a988
  numpy.float64 object is not iterable jcdr91 1 1,639 Apr-22-2020, 04:09 PM
Last Post: jefsummers
  What is the mechanism of numpy function returning pandas object? Ibaraki 2 385 Apr-04-2020, 10:57 PM
Last Post: Ibaraki

Forum Jump:

Users browsing this thread: 1 Guest(s)