在两个不同的文件中,我应用了相同的代码
import numpy as np
a = check[0:30]
**print(a)**
ai = [[item[1] for item in check[0:30]]]
a1 = np.array(ai)
**print(a1.shape)**
a2 = np.reshape(a1,(-1,))
**print(a2.shape)**
a = list(a2)
但答案不同
第一个答案如下
[['grind'], ['fracture'], ['edge'], ['instal'], ['protection'], ['transport'], ['injuries'], ['head'], ['sustain'], ['remove'], ['use'], ['step'], ['die'], ['skylight'], ['walk'], ['ladder', 'treat'], ['lose'], ['company'], ['emergency'], ['employees'], ['open'], ['roofer'], ['break'], ['land'], ['call'], ['back'], ['employ'], ['balance'], ['suffer'], ['material']]
(1, 30)
(30,)
第二个看起来像
['ladder', 'fracture', 'grind', 'build', 'transport', 'concrete', 'instal', 'injuries', 'head', 'use', 'treat', 'sustain', 'edge', 'company', 'employees', 'metal', 'remove', 'emergency', 'protection', 'die', 'floor', 'leave', 'call', 'slip', 'skylight', 'employ', 'admit', 'step', 'back', 'lose']
(30, 1)
(30,)
我想把np.array改成第二个。 我该如何更改代码
目前没有回答
相关问题 更多 >
编程相关推荐