python - SyntaxError: can't assign to function call (For Loop) -
hi trying create new array previous array. such in new array first element mean of first 20 elements existing array. here code. not sure why not working.
#averages rpma=[] in range(9580): j in range (0,191600): a=rpm.iloc[j:j+20] rpma(i)= a.mean()
looks me you're using wrong kind of brackets. line:
rpma(i)= a.mean()
...should this:
rpma[i]= a.mean()
but i'm no python expert. guessing thinks rpma(i)
function because use parentheses, in case trying assign value function call, error says.
however trying assign new value past end of array result in indexerror
because array element doesn't exist, , need added. can instead this:
rpma.append(a.mean())
...which append data end of array (i.e. adding new element).
Comments
Post a Comment