Problem with assignment. Python error or mine?
rafaeltfreire at gmail.com
rafaeltfreire at gmail.com
Thu Dec 21 10:31:39 EST 2017
Em quinta-feira, 21 de dezembro de 2017 16:21:57 UTC+1, Neil Cerutti escreveu:
> On 2017-12-21, rafaeltfreire at gmail.com <rafaeltfreire at gmail.com> wrote:
> > 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
>
> np.arange creates an object. The assignment makes X refer to that
> object.
>
> > x1=X
>
> X refers to the previous object, and then the assignment makes x1
> refer to that same object.
>
> --
> Neil Cerutti
Ok, great thank you. I am kind of new in python. I use to program in MATLAB but I am trying to migrate.
So, to fix it what should I do? because my X is an NMR spectrum of many samples.
Thank you very much!
Rafael
More information about the Python-list
mailing list