I am new to numpy ... Supposing I have 2 vectors v1 and v2 and a value (constant) k. I want to build a vector r with all values of v1 greater than k and the others from v2.
I found 2 ways, but not sure if they are the best solution: 1. r1=v1.copy() r2=v2.copy() r1[r1<k]=0 r2[r2>=k]=0 r=r1+r2 2. r=v1*(v1>=k)+v2*(v2<k) Are there any better sols.? Thanks for help/comments. -- https://mail.python.org/mailman/listinfo/python-list