空值的稀疏矩阵

时间:2018-11-01 02:55:28

标签: python

我想转换当前输入:

a = [[[], [], [], [], [], [], []], [[], [], [], [], [], [], [], []]]

类似于coo_matrix:

[ (0,0)   []
    (0,1)  []
        .
        .
        .
        .
        .
        .
        .
        .
        .
        .
        (x,y)
            ]

代码:

for i,x in enumerate(a):
    for ii, xx in enumerate(x): #Anyway to shorten this part to search that it has 2 indices?
        for iii,xxx in enummerate(xx):
            coo_matrix(([],(ii,iii)))

我尝试了许多其他方法,但是所有方法都返回一个列表,而不返回coo_matrix

0 个答案:

没有答案