Python Forum
Make a table from a json output
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Make a table from a json output
#1
Hi all

Hope someone can point me in the right direction here.
Im using api to call a website, where i get this response. (cleaned for a few things)

So below i got the data. I would like to make a table from that data. First just a simple table inside python, later on a table i can put in a browser. (using flask or others)

Task1:
But how do i do it?
Would like the headers listed in top: Date | Day | Week | Season .... | points | o:points etc.
Then the data from groups below that. 20110911| Sunday | 1 | 2011 .... | 30 | 13 etc.
20110918| Sunday | 2 | 2011 .... | 12 | 30 etc.

Task2:

Add a header so after the total header there is a another one called: SUM
And below that "column" i would like to make a calculation from the points and o:points columns. like below

Date | Day | Week | Season .... | points | o:points | SUM etc.
20110911| Sunday | 1 | 2011 .... | 30 | 13 | 43 etc.
20110918| Sunday | 2 | 2011 .... | 12 | 30 | 42 etc.

Its my first post in here, and im pretty new to these part of python, but hoping i have described it good enough.
Thanks in advance for all inputs.

/ Carsten

data = json.loads(temp)
pprint(data)
{'groups': [{'columns': [[20110911, 20110918],
                         ['Sunday', 'Sunday'],
                         [1, 2],
                         [2011, 2011],
                         ['Bears', 'Bears'],
                         ['Falcons', 'Saints'],
                         ['home', 'away'],
                         [30, 13],
                         [12, 30],
                         [2.0, 6.0],
                         [40.5, 47.0]],
             'sdql': 'team = Bears and season = 2011 and week < 3'}],
 'headers': ['date',
             'day',
             'week',
             'season',
             'team',
             'o:team',
             'site',
             'points',
             'o:points',
             'line',
             'total']}
Reply


Messages In This Thread
Make a table from a json output - by carstenlp - Dec-29-2018, 09:10 PM
RE: Make a table from a json output - by Unisoftdev - Dec-29-2018, 10:17 PM
RE: Make a table from a json output - by carstenlp - Dec-29-2018, 11:32 PM
RE: Make a table from a json output - by stullis - Dec-30-2018, 12:36 AM
RE: Make a table from a json output - by carstenlp - Dec-30-2018, 05:21 PM
RE: Make a table from a json output - by stullis - Dec-30-2018, 08:43 PM
RE: Make a table from a json output - by carstenlp - Dec-30-2018, 09:35 PM
RE: Make a table from a json output - by snippsat - Dec-30-2018, 11:04 PM
RE: Make a table from a json output - by carstenlp - Jan-01-2019, 08:30 PM
RE: Make a table from a json output - by snippsat - Jan-01-2019, 09:42 PM
RE: Make a table from a json output - by carstenlp - Jan-04-2019, 08:58 PM
RE: Make a table from a json output - by snippsat - Jan-04-2019, 10:37 PM
RE: Make a table from a json output - by carstenlp - Jan-05-2019, 09:52 PM
RE: Make a table from a json output - by carstenlp - Jan-12-2019, 09:06 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  write json into a table herobpv 4 1,424 Jan-22-2023, 04:36 AM
Last Post: herobpv
  Convert Json to table format python_student 2 5,051 Sep-28-2022, 12:48 PM
Last Post: python_student
  geojson to json --missing multiple row output yoshi 9 2,643 Mar-06-2022, 08:34 PM
Last Post: snippsat
  Python script to summarize excel tables, then output a composite table? i'm a total n surfer349 1 2,289 Feb-05-2021, 04:37 PM
Last Post: nilamo
  sports Stats > table output loop problems paulfearn100 3 2,444 Jul-22-2020, 03:21 AM
Last Post: c_rutherford
  Save output into a Excel Sheet with Format Table skaailet 1 2,455 Apr-17-2020, 11:56 PM
Last Post: thirteendec
  json.dumps list output qurr 12 5,063 Apr-08-2020, 10:13 PM
Last Post: micseydel
  json.dumps output error in python3 prayuktibid 2 2,608 Jan-21-2020, 06:41 AM
Last Post: prayuktibid
  Output to a json file problem Netcode 3 3,657 Nov-22-2019, 01:44 AM
Last Post: Skaperen
  Problem Table Output Phil 4 2,572 May-19-2019, 12:17 PM
Last Post: Phil

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020