Bottom Page

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

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  import numpy problem ptnb 1 224 May-18-2020, 06:03 PM
Last Post: ptnb
  'numpy.ndarray' object is not callable ato_cr 1 150 May-12-2020, 08:12 AM
Last Post: anbu23
  cv2/numpy d8a988 4 178 Apr-29-2020, 03:37 PM
Last Post: d8a988
  numpy.float64 object is not iterable jcdr91 1 400 Apr-22-2020, 04:09 PM
Last Post: jefsummers
  What is the mechanism of numpy function returning pandas object? Ibaraki 2 181 Apr-04-2020, 10:57 PM
Last Post: Ibaraki
  converting dataframe to int numpy array glennford49 1 228 Apr-04-2020, 06:15 AM
Last Post: snippsat
  Replacing sub array in Numpy array ThemePark 5 287 Apr-01-2020, 01:16 PM
Last Post: ThemePark
  trouble installing numpy GloryHoleLover 3 209 Mar-29-2020, 06:35 AM
Last Post: ndc85430
  How to prepare a NumPy array which include float type array elements subhash 0 213 Mar-02-2020, 06:46 AM
Last Post: subhash
  convert 'A B C' to numpy float matrix rezabma 4 217 Feb-27-2020, 09:48 AM
Last Post: rezabma

Forum Jump:


Users browsing this thread: 1 Guest(s)