我有这个json文件:
{
"walk": [
{
"date": "2021-01-10",
"duration": 301800,
"levels": {
"data": [
{
"timestamp": "2021-01-10T13:16:00.000",
"level": "slow",
"seconds": 360
},
{
"timestamp": "2021-01-10T13:22:00.000",
"level": "moderate",
"seconds": 2940
},
{
"dateTime": "2021-01-10T14:11:00.000",
"level": "fast",
"seconds": 300
并且我想要解析该数据,以使其成为1分钟级别的时间序列数据。(即:6个数据点(360秒= 6分钟)作为水平“慢”。
timestamp level
2021-01-10 13:16:00 slow
2021-01-10 13:17:00 slow
.......
2021-01-10 13:22:00 moderate
我现在有权利:
with open('walks.json') as f:
df = pd.json_normalize(json.load(f),
record_path=['walk']
)
但它返回的是嵌套在一个单元格中的每一天的级别。
1条答案
按热度按时间nr9pn0ug1#
需要嵌套record_path级别