deleting rows in numpy array

后端 未结 6 1699
自闭症患者
自闭症患者 2020-12-01 00:01

I have an array that might look like this:

ANOVAInputMatrixValuesArray = [[ 0.96488889, 0.73641667, 0.67521429, 0.592875, 
0.53172222], [ 0.78008333, 0.59381         


        
6条回答
  •  日久生厌
    2020-12-01 00:29

    I might be too late to answer this question, but wanted to share my input for the benefit of the community. For this example, let me call your matrix 'ANOVA', and I am assuming you're just trying to remove rows from this matrix with 0's only in the 5th column.

    indx = []
    for i in range(len(ANOVA)):
        if int(ANOVA[i,4]) == int(0):
            indx.append(i)
    
    ANOVA = [x for x in ANOVA if not x in indx]
    

提交回复
热议问题