read_json()

noun

say it: “REED JAY-sun” /ˈrid ˈdʒeɪsən/

A pandas function that reads data in the JSON format into a table, with one row for each record.

What does read_json() do in pandas?

read_json() (pd.read_json) loads a JSON file into a DataFrame, one row for each record and one column for each key. With lines=True, it reads JSON Lines, a file with one record on each line.

import pandas as pd
latest = pd.read_json("latest_reviews.json")              # a list of records
log = pd.read_json("review_log.jsonl", lines=True)        # one record per line

In a sentence

  • “read_json() turned the app's review export into a table.”
  • “The log had one record per line, so she gave read_json() lines=True.”

Level: Journeyman · More Python terms at this level

Updated