Quantium Virtual Internship - Retail Strategy and Analytics - Task 1
Python Conversion (Part 1)
import pandas as pd
import numpy as np
import [Link] as plt
import seaborn as sns
from [Link] import ttest_ind
file_path = "YOUR_FOLDER_PATH/"
transactionData = pd.read_csv(file_path + "QVI_transaction_data.csv")
customerData = pd.read_csv(file_path + "QVI_purchase_behaviour.csv")
[Link]()
[Link]()
[Link]()
transactionData["DATE"] = pd.to_datetime(
transactionData["DATE"],
origin="1899-12-30",
unit="D"
)
transactionData["PROD_NAME"].value_counts().head(20)
product_words = transactionData["PROD_NAME"].[Link]().explode()
product_words.value_counts().head(20)
product_words = product_words[
~product_words.[Link](r"\d|&", regex=True)
]
transactionData = transactionData[
~transactionData["PROD_NAME"].[Link]().[Link]("salsa")
]
[Link](include="all")
transactionData[transactionData["PROD_QTY"] == 200]
customer_id = transactionData[
transactionData["PROD_QTY"] == 200
]["LYLTY_CARD_NBR"].iloc[0]
transactionData[
transactionData["LYLTY_CARD_NBR"] == customer_id
]
transactionData = transactionData[
transactionData["LYLTY_CARD_NBR"] != customer_id
]
Note:
The remaining sections of the R Markdown file (date analysis, feature engineering,
customer segmentation, statistical testing, deep dive analysis and insights) will
be included in the following parts of the complete PDF conversion.