我有一个多维numpy数组,我想根据特定的列进行拆分。
例如:
我目前正在使用这个语句,但我认为它不正确。
例如:
[[1,0,2,3],[1,2,3,4],[2,3,4,5]]
。假设我想通过表达式x <=2
来拆分这个数组。那么我将得到两个数组,[[1,0,2,3],[1,2,3,4]]
和[[2,3,4,5]]
。我目前正在使用这个语句,但我认为它不正确。
splits = np.split(S, np.where(S[:, a] <= t)[0][:1]) #splits S based on t
#a is the column number
x<=2
是什么意思?x
是您的行号吗? - orange