Replacing Numpy Array With Max Value January 26, 2024 Post a Comment I have an array, a = np.array([[0,9,8],[5,6,4]]) how to replace the each array in axis 1 with the max value of its array? excepting output- a = np.array([9,6]) where 9 is the maxSolution 1: You should usenp.max(a, axis=1) CopyLink to documentation Solution 2: another implementation you can do thisBaca JugaHow To Calculate An Equation In A String, PythonRead Multiple Csv Data Files And Sort The Data Into A New Csv FileHow Can I Fix 502 Error In A Flask Application That I Uploaded In Aws?np.array([max(i) for i in a]) Copy Share You may like these postsUsing Memmap Files For Batch ProcessingRepeat But In Variable Sized Chunks In NumpyScipy Imsave Saves Wrong ValuesCreate A Frequency Matrix For Bigrams From A List Of Tuples, Using Numpy Or Pandas Post a Comment for "Replacing Numpy Array With Max Value"
Post a Comment for "Replacing Numpy Array With Max Value"