我有一個包含四列/特徵的元組,並希望根據列的值過濾行。過濾Python的元組
score =[a for a in tup if a[1] == 0.1]
輸出是print(score)
[array([ -2.41888055e-01, 1.00000000e-02, 1.00000000e-08,
1.00000000e-05]), array([ -2.41888055e-01, 1.00000000e-02, 2.39502662e-08,
1.00000000e-05]), array([ -2.41888055e-01, 1.00000000e-02, 5.73615251e-08,
1.00000000e-05]), array([ -2.41888055e-01, 1.00000000e-02, 1.37382380e-07,
1.00000000e-05]), array([ -2.41888055e-01, 1.00000000e-02, 3.29034456e-07,
1.00000000e-05]), array([ -2.41888055e-01, 1.00000000e-02, 7.88046282e-07,
1.00000000e-05]), array([ -2.41888055e-01, 1.00000000e-02, 1.88739182e-06,
1.00000000e-05]), array([ -2.41888054e-01, 1.00000000e-02, 4.52035366e-06,
1.00000000e-05]), array([ -2.41888054e-01, 1.00000000e-02, 1.08263673e-05,
1.00000000e-05]), array([ -2.41888053e-01, 1.00000000e-02, 2.59294380e-05,
1.00000000e-05]), array([ -2.41888050e-01, 1.00000000e-02, 6.21016942e-05,
1.00000000e-05]), array([ -2.41888043e-01, 1.00000000e-02, 1.48735211e-04,
1.00000000e-05]), array([ -2.41888026e-01, 1.00000000e-02, 3.56224789e-04,
1.00000000e-05]), array([ -2.41887986e-01, 1.00000000e-02, 8.53167852e-04,
1.00000000e-05]), array([ -2.41887896e-01, 1.00000000e-02, 2.04335972e-03,
1.00000000e-05]), array([ -2.41887705e-01, 1.00000000e-02, 4.89390092e-03,
1.00000000e-05]), array([ -2.41887377e-01, 1.00000000e-02, 1.17210230e-02,
1.00000000e-05]), array([ -2.41887150e-01, 1.00000000e-02, 2.80721620e-02,
1.00000000e-05]), array([ -2.41888211e-01, 1.00000000e-02, 6.72335754e-02,
1.00000000e-05]), array([ -2.41891897e-01, 1.00000000e-02, 1.61026203e-01,
1.00000000e-05]), array([ -2.41895321e-01, 1.00000000e-02, 3.85662042e-01,
1.00000000e-05]), array([ -2.41895312e-01, 1.00000000e-02, 9.23670857e-01,
1.00000000e-05]), array([ -2.41892873e-01, 1.00000000e-02, 2.21221629e+00,
1.00000000e-05]), array([ -2.41889564e-01, 1.00000000e-02, 5.29831691e+00,
1.00000000e-05]), array([ -2.41888135e-01, 1.00000000e-02, 1.26896100e+01,
1.00000000e-05]), array([ -2.41888055e-01, 1.00000000e-02, 3.03919538e+01,
我想同時保持的值的序列的所有這種單獨的陣列結合回一個元組。請幫助我,並提供過濾此元組的方法。
您確定您正確使用術語'tuple'嗎?那個數組列表看起來像一個單元組? – roganjosh
數組的形狀將是(588,4)。 –
我仍然沒有得到「元組」的使用。這是我的知識嗎?你只需要一個多維數組。 – roganjosh