Replacing Numpy Array With Max Value November 21, 2023 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 JugaLogical Or For Bit-string In PythonPython Help To Debug An Error When Modify A File In A Stream ModeTurtle Graphic Window Not Working From Vs Codenp.array([max(i) for i in a]) Copy Share You may like these postsIn Dataframe: How To Pull Minutes And Seconds Combinedly(mm:ss) From Timedelta Using PythonSkip Saving Row If Slug Already Exists In Postgresql Database - PythonPython: From X Import Y Changes Previous Import ResultOR Statement Handling Two != Clauses Python Post a Comment for "Replacing Numpy Array With Max Value"
Post a Comment for "Replacing Numpy Array With Max Value"