pandas JSON Read JSON

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

can either pass string of the json, or a filepath to a file with valid json

In [99]: pd.read_json('[{"A": 1, "B": 2}, {"A": 3, "B": 4}]')
Out[99]:
   A  B
0  1  2
1  3  4

Alternatively to conserve memory:

with open('test.json') as f:
    data = pd.DataFrame(json.loads(line) for line in f)


Got any pandas Question?