katarin.b...@gmail.com wrote: > Hi again, > > I am trying to subtract the minimum value from all numbers (in one array). > I am using this: > > > (array[:,1] -= np.min(array[:,1]) but I alsways have syntaxerror:invalid > syntax. Do I need some import for this -=? or its something else? THanks!
The name np is probably a reference to numpy, so you need an import for it: import numpy as np However, when you forget the above import you will get a NameError like >>> np Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'np' is not defined whereas a SyntaxError indicates that your code is not valid Python. The problem are the surrounding parentheses. A simple example: >>> x = 42 Wrong: >>> (x -= 1) File "<stdin>", line 1 (x -= 1) ^ SyntaxError: invalid syntax Correct: >>> x -= 1 >>> x 41 -- https://mail.python.org/mailman/listinfo/python-list