ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 26 Jun 2013 19:36:41 +0200refresh numpy array in a for-cyclehttps://ask.sagemath.org/question/10291/refresh-numpy-array-in-a-for-cycle/Hi experts!
Im writing a code with a numpy array L, the numpy matrix M and the next script:
for x in L:
for l in srange(N):
z= l in L
if z is False and M[x,l] != 0:
L=np.append(L,l)
here, in the end of the cycle, new elements are incorporated to the array 'L'.
I want these new elements be considered as 'x' index in the cycle.
When I execute the script I see that only the 'originals' elements of L are considered as 'x'.
How can i fix it?
Waiting for your answers.
Thanks a lot!
mresimulatorWed, 26 Jun 2013 19:36:41 +0200https://ask.sagemath.org/question/10291/frequency (count) in Numpy Arrayhttps://ask.sagemath.org/question/10279/frequency-count-in-numpy-array/Hi experts!
For a list `L` the command `L.count(z)` shows the number of times that the element `z` is repeated in list `L`.
For example:
[I] L=[1,1,3,1,4,5,8]
[I] L.count(1)
[O] 3
How can i do that with a Numpy array?
Waiting for your answers.
Thanks a lot!
mresimulatorTue, 25 Jun 2013 18:28:27 +0200https://ask.sagemath.org/question/10279/