Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

sales _ ranks = { } with gzip.open ( drive / MyDrive / meta _ Clothing _ Shoes _ and _ Jewelry.jsonl.gz )

sales_ranks ={}
with gzip.open("drive/MyDrive/meta_Clothing_Shoes_and_Jewelry.jsonl.gz") as products:
for i, product in enumerate(products):
#Uncomment these lines to reduce the debug cycle for troubleshooting only !!!
#if i >10000: # 10000 because we don't hit Nike products for a while
# break
data = json.loads(product)
categories =[]
for category_list in data.get("categories",[]):
_catlist =[]
for item in category_list:
if item.strip()!= item:
print(category_list)
_catlist.append(item.lower())
categories +=_catlist
if "nike" in categories:
if data.get("salesRank"):
# TODO: Complete the extraction of sales rank and populate
# that information into the sales_ranks dictionary, keyed
# by the asin value.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual Basic6 Database Programming

Authors: John W. Fronckowiak, David J. Helda

1st Edition

0764532545, 978-0764532542

More Books

Students also viewed these Databases questions