回答編集履歴

1

Update

2021/11/08 05:39

投稿

melian
melian

スコア20675

test CHANGED
@@ -28,11 +28,13 @@
28
28
 
29
29
  json_obj = json.loads(json_text)['results']
30
30
 
31
+ cols = ['to', 'from']
32
+
31
33
  df = pd.DataFrame(
32
34
 
33
- [[j['to'][0]['id'], j['from']['id']] for j in json_obj],
35
+ [[j[cols[0]][0]['id'], j[cols[1]]['id']] for j in json_obj],
34
36
 
35
- columns = list(json_obj[0].keys())[::-1])
37
+ columns = cols)
36
38
 
37
39
 
38
40