You are on page 1of 2

GrabOnRent - Data Science Internship Assignment

Company ‘X’ is a rental ecommerce platform that rents products from different categories to people
for fixed durations. The excel sheet contains the company data related to various orders.

File 1 (“data_extension.xlsx”) – contains the orders placed by customers where each field is as
follows:
Order ID
Extension Of – Previous Order ID number (Problem 1 below provides more details)
Archive – Some kind of tag
Quantity – Number of products rented
City – city in which the order was placed

File 2 (“data_date.xlsx”) – contains the orders placed by customers where each field is as follows:
Order ID
Archive – Some kind of tag
Quantity – Number of products rented
Start Date – date at which the item was delivered to the customer
End Date – date at which item was returned by the customer
City – city in which the order was placed

Problem Statement:

1. In File1, you have to derive another variable “Parent ID”.


Example - Suppose, you have an initial mapping of “Order ID” and “Extension Of” as:

Order ID Extension Of

SL384

SL10046 SL384

SL11995 SL10046

The new table which has the “Parent ID” column will look like -

Order ID Extension Of Parent ID

SL384 SL384

SL10046 SL384 SL384

SL11995 SL10046 SL384

Save the output as “<name>_parent_ids.csv”


2. In File2, you have to split both the start and end dates into intervals of 30 days, and derive
two new variables “split start date” and “split end date”.

Example: The below example illustrates how split dates are created when the Start Date is
“01/05/2017” and the End Date is “06/07/2017”

Suppose, an order have start and end dates as below

Order Id Start Date End Date


1 01/05/2017 06/07/2017

The new table with ‘split start date’ and ‘split end date’ will look like

Order Id Start Date End Date


Split start Split End
Date Date
1 01/05/2017 06/07/2017 01/05/2017 30/05/2017
1 01/05/2017 06/07/2017 31/05/2017 29/06/2017
1 01/05/2017 06/07/2017 30/06/2017 06/07/2017

Also, save the output as “split_dates.csv”

Perform the above two tasks in a single script in R programming and share it as “<Name>_task.R” .
(Please make comments to the code) and share the output in .csv format.

All the Best!

You might also like