I am pursuing a MSc in Data Science and I have the following statement:
Import the file EE_points.json from data folder. Examine the data set and display the names of the columns, the contents of the first 7 rows, and the total number of rows.
I did all the steps correctly except the last.
# My answer
import json
import pandas as pd
# To check the data set I do:
with open('./data/EE_points.json') as f:
data = json.load(f)
for query in data:
print(query)
# To check the names of the columns I do:
keys = query.keys()
print(keys)
# To see the first 7 rows I do:
pd.read_json('./data/EE_points.json').head(7)
# To check the total numbers of rows I do:
length = len(query)
print(length)
The last step, when I have to count the rows printing length I get the number of columns instead of rows.