<jupyter_start><jupyter_text>Basic Data Processing and VisualizationWeek 2Live-Coding: JSON<jupyter_code>import csv
path = "datasets/review.json"
f = open(path, 'r')
lines = []
for i in range(50000):
    lines.append(f.readline())
lines[0]
d = eval(lines[0])
d
d['user_id']
d['stars']
d['text']
import json
d = json.loads(lines[0])
d
path = "datasets/business.json"
f = open(path, 'r', encoding = 'utf8')
dataset = []
for i in range(50000):
    dataset.append(json.loads(f.readline()))
dataset[0]
dataset[0]['attributes']<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17785843920145192, 'fraction_numerical': 0.030852994555353903, 'mean_word_length': 6.2631578947368425, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '384388', 'license': 'MIT', 'n_tokens_mistral': 223, 'n_tokens_neox': 214, 'n_words': 46, 'path': '1-Basic Data Processing and Visualization/Wk2/Untitled.ipynb', 'repo_name': 'garynth41/Python-Data-Products-for-Predictive-Analytics-Specialization', 'size': '551'}