Hi,
I am new to python and have made a couple of definitions. I imported
them and they worked ok except for one which gave me the error
"NameError: global name 'np' is not defined". I then edited my script
for the def to include "import numpy as np" saved it and imported the
def again. However, it still gives me the same error. I know I have to
be doing something basic wrong but cant figure it out, anyone know what
I am doing wrong. The def is below.
thanks
D
import numpy as np
def find_nearest(array,value):
idx=(np.abs(array-value)).argmin()
return array[idx]
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor