Complete the code to read a JSON file into a pandas DataFrame.
import pandas as pd df = pd.[1]('data.json')
The read_json function reads JSON files into a pandas DataFrame.
Complete the code to read JSON data from a string using pandas.
import pandas as pd json_str = '{"name": ["Alice", "Bob"], "age": [25, 30]}' df = pd.read_json([1])
To read JSON from a string, pass the string variable to read_json.
Fix the error in the code to correctly read a JSON file with pandas.
import pandas as pd df = pd.read_json('data.json', [1]='records')
The orient parameter specifies the expected JSON string format.
Fill both blanks to create a DataFrame from JSON data and display the first rows.
import pandas as pd json_path = 'data.json' df = pd.[1](json_path) print(df.[2]())
Use read_json to load JSON data and head() to show the first rows.
Fill all three blanks to read JSON data, select a column, and convert it to a list.
import pandas as pd df = pd.[1]('data.json') names = df[[2]].[3]()
Read JSON with read_json, select the 'name' column, and convert it to a list with tolist().
