0

I have a json file which has data like :

"data": [[1467398683, "GB", "204.0.20", "tracks", "content-based", "b47911d0e80d1a8a959a2b726654bbfa", "Dance & Electronic", 1466640000, 413933, 413933,

I am trying to parse this non key value json file into a dataframe in python, can someone suggest how this can be achieved ?

2
  • Can you post the entire JSON file content? Commented Aug 23, 2019 at 13:42
  • ...because what you've posted, by itself, isn't valid JSON. Typically, the answer to "how do I parse a JSON file with Python" is "use the json module". If you've tried that and it didn't work, it would also help if you updated your question to show the code you've tried and explain how it failed. Commented Aug 23, 2019 at 13:43

1 Answer 1

1

You have two way:

  1. Pandas read_json method have parameter (orient = 'values')

    df = pd.read_json(path, orient='values')
    
  2. Or if you need you data like a matrix you can do this

    df = pd.DataFrame(json.load('{"data": [[1467398683,..your data...}')['data'])
    
  3. Please see also this thread (Parsing json values in pandas read_json)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.