如果我理解正确,我认为您的意思是从A[Xi] > B[Xi]
,您实际上是指row[Xi] > next_row[Xi]
。
>>> A = [51, 134]
>>> B = [40, 110]
>>> C = [41, 191]
>>> D = [35, 198]
>>> E = [30, 140]
>>> arr = np.vstack([A, B, C, D, E])
>>> arr
array([[ 51, 134],
[ 40, 110],
[ 41, 191],
[ 35, 198],
[ 30, 140]])
>>> # (row_i[X1] > row_i+1[X1]) and (row_i[X2] > row_i+1[X2])
>>> cond1 = np.cumprod(arr[:-1] > arr[1:]).all(axis=1)
>>> cond1
array([ True, False, False, False])
>>> # (row_i[X1] > row_i+1[X1]) and (row_i[X2] < row_i+1[X2])
>>> cond2 = (arr[:-1, 0] > arr[1:, 0]) | (arr[:-1, 1] > arr[1:, 1])
>>> cond2
array([ True, False, True, True])
>>> cond1 | cond2
array([ True, False, True, True])
>>> arr[:-1][cond1 | cond2]
array([[ 51, 134], # A
[ 41, 191], # C
[ 35, 198]]) # D