champagnecat983

champagnecat983

Lv1

0 Followers
0 Following
0 Helped

ANSWERS

Published3

Subjects

Computer Science3
a= input() b = input() print(a+b)

Objective: Take a sample feed, parse it, augment it, and output individual JSON objects for each product in it.

product.txt

  • The file contains several fields of basic product information for 1000 products.
  • Data for each product is on one line, with fields separated by a vertical pipe character.

This particular retailer classifies products into a particular store, department, category, and subcategory.

Example >

  • A Blender might have the following "taxonomy" or category classification.

Home & Garden > Kitchen & Dining > Appliances > Blenders

Store

Department

Category

Subcategory

store_id

department_id

category_id

subcategory_id

Ā 

These IDs are also represented in a sort of shorthand.

  • They should all be prefixed by the first three letters of their respective field name.

A store_id of 1 becomes sto1

A department_id of 2 becomes dep2

A category_id of 3 becomes cat3

A subcategory_id of 4 becomes sub4

targets.txt

  • A system to keep track of these various classifications
    • Example
      • A store_id of sto40 maps to a ā€œtarget valueā€ of 187298 in PromoteIQ's system

Output Example:

The desired output for the first product is one line of JSON that when pretty-printed looks like:

{

Ā  "sku": "22067130",

Ā  "name": "Brainboxes ES-571 Brainboxes Es-571 Industrial Isolated Ethernet to Serial + Switch - 1 x Network (R",

Ā  "description": "Brainboxes ES-571 Brand New Includes Lifetime Warranty Product # ES-571 Factory floors can be harsh environments.",

Ā  "priceList": 387.95,

Ā  "taxonomy": [

Ā Ā Ā  "sto2",

Ā Ā Ā  "dep7",

Ā Ā Ā  "cat270",

Ā Ā Ā  "sub18532"

Ā  ],

Ā  "targetValues": [

Ā Ā Ā  187167,

Ā Ā Ā  187177,

Ā Ā Ā  187950,

Ā Ā Ā  196404

Ā  ]

}

Ā 

The taxonomy IDs have been mapped to their long form and placed in the taxonomy property.

  • Each taxonomy ID has also been mapped to its corresponding target value ID from the targets.txt file
    • and that result is stored in the targetValues
    • The priceList property is the product price as a JSON float, not a string
you use pandas in python to read json.Json data generally has different orient...
Java script is one of the programming languages which is mostly used in web de...

Weekly leaderboard

Start filling in the gaps now
Log in