Learn practical skills, build real-world projects, and advance your career
!sudo pip3 install simplejson
import simplejson as json
Requirement already satisfied: simplejson in /usr/local/lib/python3.6/dist-packages (3.17.0)
# Connect Collab to Drive
from google.colab import drive
drive.mount('/content/gdrive')
Drive already mounted at /content/gdrive; to attempt to forcibly remount, call drive.mount("/content/gdrive", force_remount=True).
!ls /content/gdrive/My\ Drive/Temp/Amazon\ Reviews/
Electronics_5.json.gz Electronics.csv Main.ipynb
import pandas as pd
import gzip

def parse(path):
  g = gzip.open(path, 'rb')
  for l in g:
    yield json.loads(l)
def getDF(path):
  i = 0
  df = {}
  for d in parse(path):
    df[i] = d
    i += 1
  return pd.DataFrame.from_dict(df, orient='index')

df = getDF("//content//gdrive//My Drive//Temp//Amazon Reviews//Electronics_5.json.gz")
df.head()