(Dec-30-2018, 09:35 PM)carstenlp Wrote: How do i add a header column? Like sum.. Where i can add the points and opointspandas is also an good option,make it easier to do stuff like calculate,sum,plot..ect.
Also when have a Dataframe it's easier to put on web as i done several times with Flask.
As your JSON(
json.loads
) output give back a dictionary.Can clean up a little and make and take into pandas with
pd.DataFrame.from_dict(d)
.Can also read JSON directly with
pandas.read_json()
. i just add
d =
in front of data output in first post.>>> record = {} >>> for i in zip(d['headers'], d['groups'][0]['columns']): ... record[i[0]] = i[1] ... >>> record {'date': [20110911, 20110918], 'day': ['Sunday', 'Sunday'], 'line': [2.0, 6.0], 'o:points': [12, 30], 'o:team': ['Falcons', 'Saints'], 'points': [30, 13], 'season': [2011, 2011], 'site': ['home', 'away'], 'team': ['Bears', 'Bears'], 'total': [40.5, 47.0], 'week': [1, 2]}Then in pandas: