Problem with assignment. Python error or mine?

rafaeltfreire at gmail.com rafaeltfreire at gmail.com
Thu Dec 21 10:05:33 EST 2017


Dear community, I am having the following problem when I am assigning the elements of a vector below a certain number to zero or any other value. 
I am creating a new variable but Python edits the root variable. Why?

import numpy as np

X=np.arange(1, 10000, 1) #root variable
x1=X 
x1[x1<10000]=0

print(X)
Out[1]: array([ 0.,  0.,  0., ...,  0.,  0.,  0.])

Why????????? It is supposed to be the original value
Thank you for your time
Rafael



More information about the Python-list mailing list