I am converting R code to python. I know the alternative of calling R from python exists, however, I need it converted to python line by line.
I have a line in the R code which says
reps[-a] <- .Machine$integer.max
where reps is a vector and a is another vector containing some indices, eg
a = [1, 2, 4]
I wanted to know how to implement this line in python.
From what I understand, it should assign the max value to all the elements in the array where the index does not equal 1,2 or 4.
Thank you.
Instead I get the following output.
`a = [1, 3, 4, 6, 79, 10, 56]
b = [0, 1, 2]
for i in b:
a[~i] = 0
a
[1, 3, 4, 6, 0, 0, 0] `
Want to know why 6 is also being printed – Moshee Jul 22 '19 at 18:47