0

I have a 2D numpy array [1,2], [3,4], [5,6]. How can I modify the values in the second column (eg. add 1 to each value, so the result would be ([1,3], [3,5], [5,7])?

1
  • 7
    arr[:,1] += 1 Commented Jan 23, 2021 at 22:46

1 Answer 1

2

Psidom's comment above worked thanks.

arr[:,1] += 1

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.