我有一個列表,它看起來像這樣,ValueError異常:設置一個數組元素與numpy的操作的序列
data_raw=[[], [7944, -11896, 3376, 1627, -850, -3991], [8688, -12192, 1936,1404, -616, -3536], [6540, -11800, 1608, 3021, 780, -1061], [6804, -11864, 3828, 4310, 552, -2343], [7208, -12544, 3768, 2542, 286, 1264], [7048, -14532, 6824, 2528, 1577, 2583], [6112, -17376, 10180, 132, -1716, 1001], [7576, -21140, 6796, -1725, 1657, 1980], [2928, -31716, 15400, -5945, 824, -3558], [8940, -24016, 11540, -12047,-5574, -16019], [12020, -17516, 3744, -14637, 1521, -14791], [8916, -16160, 5860, -14122, -3793, -13597], [10144, -8124, 1076, -12027, -1194, -8809], [8088, -7264, 928, -18441, -2058, -80], [7684, -4896, -5224, -9800, 2427, 2054], [2040, -7776, -3520, -9306, 4442, 1276], [6240, -7340, -7216, -1757, -3630, -2734], [5720, -3940, -4632, -901, 1469, -1682], [5244, -4676, -5648, 2720, 3526, -436], [4016, -5336, -2976, 4280, 4543, -1562], [4028, -5156, -5560, 7391, 5000, -1317], [748, -9800, -2144, 10353, 6616, -3390], [10268, -7220, 1844, 11657, 8566, -4740], [11300, -10752, 4508, 11666, 10771, -1356], [16792, -10180, 24476, 13474, 2828, -5205], [19208, -10908, 6636, 9747, 10501, 1676], [7540, -20480, 13248, 8715, 12607, 7017], [15780, -20832, 11600, 5686, 4737, -3654], [18004, -20072, 17716, 1082, 2218, -3181], [16516, -18528, 14568, -3931, -5457, -4260], [15596, -12596,9084, -7735, -8646, -4221], [13296, -8948, 6316, -9215, -8260, -3225], [10860, -8124, 6116, -7264, -7653, -678], [7968, -7828, 5384, -8604, -7043, 1076], [8008, -5316, 1816, -6457, -7414, -50], [9304, -3568, 1092, -4895, -4654, 3123], [9560, -3932, -352, -904, -6369, 1981], [14692, -3168, 836, 2406, -8099, 3121], [13088, -6292, 44, 5503, -11759, 6405], [11892, -8316, -836, 6159, -8673, 10130], [8252, -13220, -1064, 8279, -7906, 12090], [3572, -18392, -1536, 5995, -2719, 10667], [2864, -19576, 960, 6207, -4501, 6554], [1024, -20140, -1964, 7834, -10817, 5197]]
當我使用以下代碼:
data = np.array(data_raw).astype(float)
我得到一個錯誤:
>> Traceback (most recent call last):
data = np.array(data_raw).astype(float)
ValueError: setting an array element with a sequence.
有誰知道爲什麼會發生此錯誤?
謝謝.... ....工作正常.... –