带矩阵的时间序列

时间:2018-10-31 07:58:10

标签: python matrix time series

我有一个垫扩展数据,我想每隔几秒就将它们分开。我的矩阵是let dataArray = isSearch ? arrFilter : countries cell.textLabel?.text = dataArray[indexPath.row].name.capitalized 时间序列3维矩阵,想要分别获取(7,5,2500)的值并将其保存

例如

(7,5,1) ...(7,5,2500)

获取该数据的每个部分,例如此矩阵

array([155,  33, 129,167,189,63,35
       161, 218,   6,58,36,25,3

       89,63,36,25,78,95,21
       78,52,36,56,25,15,68
       ]],

       [215, 142, 235,
        143, 249, 164],

       [221,  71, 229,
         56,  91, 120],

       [236,   4, 177,
        171, 105,  40])

我该怎么办?

2 个答案:

答案 0 :(得分:0)

a = [[155,  33, 129, 161, 218,   6],
     [215, 142, 235, 143, 249, 164],
     [221,  71, 229,  56,  91, 120],
     [236,   4, 177, 171, 105,  40]]

print(a[1])

答案 1 :(得分:0)

假设您将数据保存在(3,5,3)数组中,则可以使用slicing提取所需的子矩阵。这是一个带有A = numpy.array([[[1,1,1], [2,2,2], [3,3,3], [4,4,4], [5,5,5]], [[11,11,11], [21,21,21], [31,31,31], [41,41,41], [51,51,51]], [[12,12,12], [22,22,22], [32,32,32], [42,42,42], [52,52,52]]] sub_matrix_1 = A[:,:,0] print (sub_matrix_1) 矩阵的示例(但该示例可以应用于任何维度):

[[ 1  2  3  4  5]
 [11 21 31 41 51]
 [12 22 32 42 52]]

会产生:

for i in range(A.shape[-1]):
    print (A[:,:,i])
    # Your submatrix is A[:,:,i], you can directly manipulate it

编辑:也可以遍历数组以获取三维数组:

Math.round( mul/count * 10 ) / 10

Math.round(Math.sqrt(sqD/y) * 10 ) / 10