如何像这样使用python重塑数据集

时间:2016-08-12 05:50:37

标签: reshape

这是原始数据

a=[[1,2,3,4,5,6],
   [7,8,9,10,11,12]]

我想将其转换为如下格式:

b=[[1,2,3,7,8,9],
   [4,5,6,10,11,12]]

array(List).swapaxes()

如何在python中使用reshape和swapax?

由于

1 个答案:

答案 0 :(得分:1)

试试这个:

{
    "array_1": [{
        "url": "xyz",
        "position": "5",
        "thumbnailImage": ""
    }],
    "array_2": [{
        "url": "abc",
        "position": "1",
        "thumbnailImage": ""
    }, {
        "url": "def",
        "position": "2",
        "thumbnailImage": ""
    }, {
        "url": "ghi",
        "position": "3",
        "thumbnailImage": ""
    }, {
        "url": "jkl",
        "position": "4",
        "thumbnailImage": ""
    }],
    "array_3": [{
        "url": "mno",
        "position": "0",
        "thumbnailImage": ""
    }]
}

检查出来:https://coderpad.io/F7X7EKR4