0

Is there a way to make a Python array in numpy of part of a vector? For example, say I have a vector v of length n, could I make an array of the elements v[2] to v[n-2]? I tried:

numpy.array(v[2]:v[n-2])

but this didn't work...

  • This should be in [SO]. There you sure will get an answer – AlexSp3 Nov 08 '21 at 11:40
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Harish Chandra Rajpoot Nov 08 '21 at 11:41
  • So i gues, you want the original array without the first and last element? If so, then you just need to use 'slicing' , that means just try 'new_v=v[1,n-1]'. – Salfalur Nov 08 '21 at 12:38

0 Answers0