how to read json file with pandas? how to read json file with pandas? json json

how to read json file with pandas?


try this:

import jsonwith open('data.json') as data_file:    data = json.load(data_file)

This has the advantage of dealing well with large JSON files that do not fit in memory

EDIT:Your data is not valid JSON.Delete the following in the first 3 lines and it will validate:

[{    "website": ["\u5341\u65b9\u521b\u6295"]}]

EDIT2[Since you need to access nested values from json]:

You can now also access single values like this:

data["one"][0]["id"]  # will return 'value'data["two"]["id"]    # will return 'value'data["three"]      # will return 'value'


Try following codes: (you are missing one something)

>>> import json>>> with open("/root/code/itjuzi/itjuzi/investorinfo.json") as file: ...     data = json.load(file.read())