Python
Obs. Send the zipped folder with your answers to [Link]@[Link] and
[Link]@[Link]
To resolve the issues below you must use the zipped folder “rappi” attached in the same e-
mail, where you will find the data to resolve the issues. Creates the .py files inside it according
to the guidelines of the questions and, at the end, sends the zipped folder again
1) Inside the folder (“rappi_python”) that you received, create a .py file and, in this file, create a
function that generates a dataframe from eache .csv file in the folder. You will use this function to
resolve the remaining issues
The function should generate dataframes like the ones below:
2) In a new .py file, import the function from question 1 and use the datraframes corresponding to
the .csv stores, verticals and metrics file. Group the number of cancels and orders by brand_id.
Insert a new column (“percentage”) on this new dataframe with the cancellation percentage and
insert another column (“store_ids”) with the store_ids of the brand that had cancels separated by
commas. Filter the new dataframe for brands of the ‘farmacia’ vertical that have more than 10% of
cancellation and print the result of each one as a string in the following format:
“The {brand_id} reached {percentage}% of cancellation.
Store ids with cancellations: {store_ids}
Vertical: {vertical}”
where brand_id, percentage, store_ids and vertical are variables
3) With the dataframe “row_data”, write a code that transform it into a new dataframe (final_df) as
in the figure bellow and displays (print) a string for each ticket_id (each row in the final_df) in the
following format:
“User {user_name} has suspended the store {store_id} until {date} for the reason: {reason}”
where the variables {user_name}, {store_id} , {dd/mm/yyyy} and {reason} for each ticker_id are
on the preview column with the format: (@name, 9 digits between 0 and 9, dd/mm/yyy and the
reason after the word “reason:”, respectively)