Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
import numpy as np pp = np.array(p) # p is some array print(pp[0]) print(pp[1]) print(pp[0] + pp[1]) results in : [138 138 138] [138 138 148] [20 20 40]
Why does this happen? Why is the addition wrong?
print(pp)
Your array is evidently composed of unsigned bytes (dtype=uint8). Your values are wrapping around within the 0..255 range of this data type.
Add a comment
Required, but never shown
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.
Explore related questions
See similar questions with these tags.
print(pp)?