reading json and retrieve the values in pyspark dataframe

Viewed 25

Can you please provide pyspark solution

The input data sources are comprised of customers (in CSV format), transactions (in JSON Linesformat) and products (in CSV format).

Their details are presented below:

Customers Contains information about customers such as the customer id and the date when they joined:

customer_id loyalty_score
C1          7

Transactions Is an ever-increasing data source that currently contains 2 years of transactions. Each transaction contains the customer id, details of what products they purchased and the date of purchase: {"customer_id": "C1", "basket": [{"product_id": "P3", "price": 506}, {"product_id": "P4", "price": 121}],"date_of_purchase": "2018-09-01 11:09:00"}

Products Contains information about products such as the product id, product description and category:

product_id product_description product_category
P100       red trousers        C

Acceptance Criteria The output data source should contain information for every customer that has the following fields:

customer_id loyalty_score product_id product_category purchase_count
C1          7             P2         F                11
C1          7             P3         H                5
C2          4             P9         H                7
0 Answers
Related