I have a numpy array full of 0's such as this
[0,0,0,0,0,0,0,0,0,0,0,0]
And a list of positions such as this
[2-4,6-10]
So what I want to do is iterate through the list of positions and then change the 0's in the numpy array to 1's within the according positions so that I should have a numpy array such as.
[0,1,1,1,0,1,1,1,1,1,0,0,0]
Hope this is clear enough, if not just let me know.
Thanks.
[-2, 6, 10](because2-4is -2). Is that what you intended?2-4in python? (the way you represent it will change the answer)[2-4,6-10]into the Python interpreter and evaluate it you will get[-2, -4]. What data structure do you actually have? Do you have a list of strings?