{
"Ankle" : {
"1544095214100" : {
"AX" : -0.3310394287109375,
"AY" : -0.3018035888671875,
"AZ" : 9.595489501953125
},
"1544095214200" : {
"AX" : -0.3290557861328125,
"AY" : -0.2254791259765625,
"AZ" : 9.609939575195312
},
"1544095214500" : {
"AX" : -0.32763671875,
"AY" : -0.22491455078125,
"AZ" : 9.612503051757812
}
} ,
"Head" : {
"1544095207100" : {
"AX" : -0.32867431640625,
"AY" : -0.2235870361328125,
"AZ" : 9.608489990234375
},
当前,我的JSON文件如下所示。我正在使用熊猫,我想从“脚腕”中提取所有时间戳值(即1544095214100)并将其添加到数组中。我怎样才能做到这一点?
答案 0 :(得分:1)
DeepSpace是正确的。不要因为使用pandas之类的库而陷入困境,为此只需使用Python。
d = {
"Ankle" : {
"1544095214100" : {
"AX" : -0.3310394287109375,
"AY" : -0.3018035888671875,
"AZ" : 9.595489501953125
},
"1544095214200" : {
"AX" : -0.3290557861328125,
"AY" : -0.2254791259765625,
"AZ" : 9.609939575195312
},
"1544095214500" : {
"AX" : -0.32763671875,
"AY" : -0.22491455078125,
"AZ" : 9.612503051757812
}
} ,
"Head" : {
"1544095207100" : {
"AX" : -0.32867431640625,
"AY" : -0.2235870361328125,
"AZ" : 9.608489990234375
}
}
}
myList = []
for key in d['Ankle'].keys():
myList.append(key)
print(myList)
因此,在上面的示例中,只需将数组替换为myList。
答案 1 :(得分:1)
如果您想对 vectory<int> resultArray = integerToArray(my_int);
int digit = resultArray[0];
做更多的事情,并找出Anker
,请执行以下操作:
Math.sqrt
现在您可以遍历myList = []
for key,value in d['Ankle'].iteritems():
temp=[key,value]
myList.append(temp)
进行第二组手术
尝试使用myList
myList[0]
和myList[0][1]
命令来进行下一步