Fast convert JSON column into Pandas dataframe

前端 未结 3 563
时光说笑
时光说笑 2020-12-08 11:38

I\'m reading data from a database (50k+ rows) where one column is stored as JSON. I want to extract that into a pandas dataframe. The snippet below works fine but is fairly

3条回答
  •  清歌不尽
    2020-12-08 12:10

    data = { "events":[
    {
    "timemillis":1563467463580, "date":"18.7.2019", "time":"18:31:03,580", "name":"Player is loading", "data":"" }, {
    "timemillis":1563467463668, "date":"18.7.2019", "time":"18:31:03,668", "name":"Player is loaded", "data":"5" } ] }

    from pandas.io.json import json_normalize
    result = json_normalize(data,'events')
    print(result)
    

提交回复
热议问题