python - Value exceptions in Numpy -
python - Value exceptions in Numpy -
i got next excerpt of code:
xmin = -20 xmax = 20 ymin = -20 ymax = 20 x = np.arange(xmin,xmax,0.1) y = np.arange(ymin,ymax,0.1)
i want python steps range of -0.1 0.1. how code this?
thanks in advance. a.
you can utilize boolean indexing on x
, y
omit values in range -0.1 0.1.
for example:
x[(x < -0.1) | (x > 0.1)]
this gives view of array x
in values either less -0.1 or greater 0.1 (i.e. won't contain values -0.1, 0, 0.1).
python numpy
Comments
Post a Comment