如何删除多维列表中的列表?

时间:2019-05-21 09:44:57

标签: python list

我有一个形状列表(8,20,400)。如何删除那个8或仅指定(20,400)作为输入尺寸?谢谢 这是numpy文件

[array([[-2.95904625e-04,  6.40423603e-04,  6.00454747e-04, ...,
        -2.27658681e-03,  4.57428713e-02,  2.19978483e-02],
       [-6.20380223e-05,  4.70707138e-04, -8.86019713e-03, ...,
         2.79925674e-02,  1.03238509e-02,  3.22103941e-02],
       [-2.43267652e-04,  4.08970515e-04, -1.00202744e-02, ...,
         1.91848757e-03,  8.25676575e-03,  2.52707651e-02],
       ...,
       [ 1.36244897e-04,  1.28135132e-04, -2.24724998e-03, ...,
         1.00482352e-02, -5.16041088e-03,  1.67575841e-02],
       [-4.56173476e-04,  4.15697708e-04, -2.91441041e-03, ...,
         6.27152348e-02,  5.86943632e-02,  3.60700986e-02],
       [ 2.97331762e-04,  3.08865978e-04, -2.51690796e-03, ...,
         1.01896998e-01,  1.18917078e-02, -1.39016820e-02]]), array([[ 2.01335059e-05,  9.97422893e-05,  1.33110081e-04, ...,
        -6.56137938e-01,  2.19010739e-01, -5.99931850e-01],
       [ 4.70135697e-05,  6.19096340e-05,  2.01980818e-03, ...,
         2.08184651e-01, -2.32254140e-02,  2.59060825e-01],
       [ 1.58539360e-04,  5.70696560e-05,  3.40425631e-03, ...,
         2.40470642e-02,  3.40782234e-02,  4.70127584e-02],
       ...,
       [ 1.47612366e-04,  3.13279823e-05,  3.65396557e-03, ...,
         3.69262189e-03,  8.34838873e-02, -3.89654154e-03],
       [ 2.46732289e-05,  3.03740157e-05,  9.34068810e-04, ...,
         9.21966957e-02, -4.49042892e-02,  1.08487106e-01],
       [-4.69590970e-05,  3.79340001e-05, -1.73730729e-03, ...,
         7.42343781e-02,  2.04405703e-01,  6.21275782e-02]]), array([[ 6.48131747e-04,  3.30629899e-04, -1.79023262e-02, ...,
         1.80307755e-02,  2.02918323e-02,  2.66390833e-02],
       [ 7.42727070e-04,  2.43741144e-04, -3.09066842e-02, ...,
        -1.43030498e-02, -8.39430839e-04, -2.06224047e-02],
       [ 7.91216410e-04,  1.74964451e-04, -3.36439668e-03, ...,
         1.24927181e-03, -3.01857133e-03,  1.68265128e-02],
       ...,

有8个这样的数组。

1 个答案:

答案 0 :(得分:0)

正如评论中指出的

import numpy as np
A = np.ndarray(shape=(8, 20, 400))
print (A.shape)      ## Prints (8, 20, 400)
print (A[0].shape)   ## Prints (20, 400)