python - deleting rows in numpy array -
i have array might this: anovainputmatrixvaluesarray = [[ 0.96488889, 0.73641667, 0.67521429, 0.592875, 0.53172222], [ 0.78008333, 0.5938125, 0.481, 0.39883333, 0.]] notice 1 of rows has 0 value @ end. want delete row contains zero, while keeping row contains non-zero values in cells. but array have different numbers of rows every time populated, , zeros located in different rows each time. i number of non-zero elements in each row following line of code: numnonzeroelementsinrows = (anovainputmatrixvaluesarray != 0).sum(1) for array above, numnonzeroelementsinrows contains: [5 4] the 5 indicates possible values in row 0 nonzero, while 4 indicates 1 of possible values in row 1 zero. therefore, trying use following lines of code find , delete rows contain 0 values. for q in range(len(numnonzeroelementsinrows)): if numnonzeroelementsinrows[q] < numnonzeroelementsinrows.max(): p.delete(anovainputmatrixvaluesarray, q, axis=0) but reason, code not...