0

I am trying to break a numpy array along a certain row so that I end up with a "top part" and a "bottom part."

example

[[2 1 3 2]   
 [1 6 7 2]
 [2 8 6 3]
 [3 4 2 2]]

top = [2 1 3 2]   

bottom = [[1 6 7 2]
          [2 8 6 3]
          [3 4 2 2]]

What is the easiest way to accomplish this? Right now I am copying the original array twice and deleting the parts I don't need. It seems like there should be an easy way to split the array into unequally sized parts. split and vsplit only seem to split into equally sized chunks. Any help is appreciated.

1 Answer 1

4
top=data[0]
bottom=data[1:3]

Basically, it's easy to slice the data as it is set up now. You could change the slice point easily if you needed to, using similar logic.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.