python 列表转化成数组_将列表转换为NumPy数组

I have a list that consits of 2000 rows and 88200 columns:

testlist = list(split_audio_to_parts(audio, self.sample_rate, self.audio_index))

debugging output of testlist gives

[array([-0.00683594, -0.00689697, -0.00708008, ..., 0. ,

0. , 0. ]), array([-0.01287842, -0.01269531, -0.01257324, ..., 0. ,

0. , 0. ]), array([0.02288818, 0.01940918, 0.01409912, ..., 0. , 0. ,

0. ]), array([0.00772095, 0.00671387, 0.00695801, ..., 0. , 0. ,

0. ]),

and so on.

split_audio_to_parts is a function:

def split_audio_to_parts(x, sample_rate, audio_index):

for i, row in audio_index.iterrows():

x_part = x[int(row['start_samples']):int(row['end_samples'])]

yield x_part

When I try to convert it to numpy array using samples = np.array(testlist) or samples = np.asarray(testlist), it gives m


版权声明:本文为weixin_39940425原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。