Судя по вашей ссылке, ваши данные имеют вид:
[array([['22.634', '22.634', '21.127', '21.244', '76012'],
['21.244', '21.372', '21.203', '21.303', '72856'],
['21.313', '21.313', '21.169', '21.244', '19960'],
['21.253', '21.295', '21.253', '21.295', '37780'],
['21.338', '21.338', '21.253', '21.33', '10960'],
['21.38', '21.38', '21.137', '21.203', '69382'],
['21.203', '21.203', '21.127', '21.195', '14168'],
['21.195', '21.195', '21.169', '21.186', '6260'],
['21.211', '21.211', '21.195', '21.203', '7180'],
['21.211', '21.262', '21.211', '21.253', '16723'],
['21.279', '21.372', '21.22', '21.279', '26393'],
['21.295', '21.372', '21.262', '21.372', '5603'],
['21.414', '21.414', '21.354', '21.414', '16722'],
['21.414', '21.531', '21.33', '21.531', '15262'],
['21.523', '21.523', '21.295', '21.338', '14198'],
['21.322', '21.389', '21.288', '21.389', '7128'],
['21.389', '21.43', '21.389', '21.422', '1067'],
['21.363', '21.438', '21.363', '21.422', '2965'],
['21.438', '21.507', '21.354', '21.38', '12356'],
['21.405', '21.422', '21.38', '21.38', '6402'],
['21.464', '21.507', '21.464', '21.507', '2830'],
['21.464', '21.507', '21.43', '21.43', '6772'],
['21.539', '21.539', '21.354', '21.422', '11167'],
['21.405', '21.464', '21.405', '21.464', '8062'],
['21.389', '21.456', '21.363', '21.438', '4988'],
['21.464', '21.464', '21.389', '21.464', '7366'],
['21.464', '21.464', '21.303', '21.372', '4979'],
['21.447', '21.447', '21.447', '21.447', '1417'],
['21.447', '21.464', '21.354', '21.456', '15294'],
['21.464', '21.548', '21.38', '21.464', '23433']], dtype='<U10')
list([0, 1])]
, что, как я полагаю, не то, что вам нужно. Могу ли я сначала предложить вам преобразовать каждый массив, содержащий int
и float
, в массив float
как таковой:
a = np.array([['22.634', '22.634', '21.127', '21.244', '76012'],
...]).astype(np.float)
Во-вторых, добавленный список в конце имеет форму, отличную от массив, чтобы они не складывались. Вам следует подумать о том, что означает этот список и почему он вам нужен. Но чтобы добавить его в массив, вы можете сделать что-то вроде:
b = [0, 1]
# make new array that will stack
c = np.empty(a.shape[1])
# fill it with NaN values
c.fill(np.nan)
# add in the data from list b
c[:len(b)] = b
c
>>> array([ 0., 1., nan, nan, nan])
Затем вы можете складывать a
и c
, чтобы получить правильный массив:
np.row_stack([a, c])
>>> array([[2.2634e+01, 2.2634e+01, 2.1127e+01, 2.1244e+01, 7.6012e+04],
[2.1244e+01, 2.1372e+01, 2.1203e+01, 2.1303e+01, 7.2856e+04],
[2.1313e+01, 2.1313e+01, 2.1169e+01, 2.1244e+01, 1.9960e+04],
[2.1253e+01, 2.1295e+01, 2.1253e+01, 2.1295e+01, 3.7780e+04],
[2.1338e+01, 2.1338e+01, 2.1253e+01, 2.1330e+01, 1.0960e+04],
[2.1380e+01, 2.1380e+01, 2.1137e+01, 2.1203e+01, 6.9382e+04],
[2.1203e+01, 2.1203e+01, 2.1127e+01, 2.1195e+01, 1.4168e+04],
[2.1195e+01, 2.1195e+01, 2.1169e+01, 2.1186e+01, 6.2600e+03],
[2.1211e+01, 2.1211e+01, 2.1195e+01, 2.1203e+01, 7.1800e+03],
[2.1211e+01, 2.1262e+01, 2.1211e+01, 2.1253e+01, 1.6723e+04],
[2.1279e+01, 2.1372e+01, 2.1220e+01, 2.1279e+01, 2.6393e+04],
[2.1295e+01, 2.1372e+01, 2.1262e+01, 2.1372e+01, 5.6030e+03],
[2.1414e+01, 2.1414e+01, 2.1354e+01, 2.1414e+01, 1.6722e+04],
[2.1414e+01, 2.1531e+01, 2.1330e+01, 2.1531e+01, 1.5262e+04],
[2.1523e+01, 2.1523e+01, 2.1295e+01, 2.1338e+01, 1.4198e+04],
[2.1322e+01, 2.1389e+01, 2.1288e+01, 2.1389e+01, 7.1280e+03],
[2.1389e+01, 2.1430e+01, 2.1389e+01, 2.1422e+01, 1.0670e+03],
[2.1363e+01, 2.1438e+01, 2.1363e+01, 2.1422e+01, 2.9650e+03],
[2.1438e+01, 2.1507e+01, 2.1354e+01, 2.1380e+01, 1.2356e+04],
[2.1405e+01, 2.1422e+01, 2.1380e+01, 2.1380e+01, 6.4020e+03],
[2.1464e+01, 2.1507e+01, 2.1464e+01, 2.1507e+01, 2.8300e+03],
[2.1464e+01, 2.1507e+01, 2.1430e+01, 2.1430e+01, 6.7720e+03],
[2.1539e+01, 2.1539e+01, 2.1354e+01, 2.1422e+01, 1.1167e+04],
[2.1405e+01, 2.1464e+01, 2.1405e+01, 2.1464e+01, 8.0620e+03],
[2.1389e+01, 2.1456e+01, 2.1363e+01, 2.1438e+01, 4.9880e+03],
[2.1464e+01, 2.1464e+01, 2.1389e+01, 2.1464e+01, 7.3660e+03],
[2.1464e+01, 2.1464e+01, 2.1303e+01, 2.1372e+01, 4.9790e+03],
[2.1447e+01, 2.1447e+01, 2.1447e+01, 2.1447e+01, 1.4170e+03],
[2.1447e+01, 2.1464e+01, 2.1354e+01, 2.1456e+01, 1.5294e+04],
[2.1464e+01, 2.1548e+01, 2.1380e+01, 2.1464e+01, 2.3433e+04],
[0.0000e+00, 1.0000e+00, nan, nan, nan]])