You are halfway there. Try:
In [4]: a[a < 0] = 0
In [5]: a
Out[5]: array([1, 2, 3, 0, 5])
More Related Contents:
- How to calculate rolling / moving average using python + NumPy / SciPy?
- Saving a Numpy array as an image
- String concatenation of two pandas columns
- Intuition and idea behind reshaping 4D array to 2D array in NumPy
- Removing nan values from an array
- How to count the occurrence of certain item in an ndarray?
- How do I compute derivative using Numpy?
- binning data in python with scipy/numpy
- How do I count the occurrence of a certain item in an ndarray?
- Calculating Pearson correlation and significance in Python
- ValueError: could not broadcast input array from shape (224,224,3) into shape (224,224)
- Python RuntimeWarning: overflow encountered in long scalars
- Selecting Random Windows from Multidimensional Numpy Array Rows
- How to copy data from a numpy array to another
- Read a base 64 encoded image from memory using OpenCv python library
- Why does numpy.linalg.solve() offer more precise matrix inversions than numpy.linalg.inv()?
- Pandas in AWS lambda gives numpy error
- Pandas groupby with categories with redundant nan
- Shuffling NumPy array along a given axis
- How to display progress of scipy.optimize function?
- Easy way to test if each element in an numpy array lies between two values?
- Python numpy: cannot convert datetime64[ns] to datetime64[D] (to use with Numba)
- ImportError: No module named numpy on spark workers
- Is there a numpy/scipy dot product, calculating only the diagonal entries of the result?
- sampling random floats on a range in numpy
- How does the axis parameter from NumPy work?
- How can I draw lines into numpy arrays?
- Fast interpolation of grid data
- numpy faster than numba and cython , how to improve numba code
- Interweaving two NumPy arrays efficiently