---
title: "Hennes & Mauritz AB's H&M is a Swedish ecommerce"
author: "Anshuman Moudgil"
date: "18 February 2022"
output:
  html_document:
    number_sections: true
    toc: true
    fig_width: 7
    fig_height: 4.5
    theme: readable
    highlight: tango
    code_folding: hide
---

<hr>

**SUBJECT: eCommerce**

- $1^{st} \text{ case is about a}$ [**Spanish** eCommerce Ulabox](https://www.kaggle.com/anshumoudgil/ulabox-ecommerce-hypothesis-strategy-clustering)
- $2^{nd} \text{ case is about a}$ [**Brazilian** eCommerce Olist](https://www.kaggle.com/anshumoudgil/olist-ecommerce-analytics-clusters-poly-equation)
- $3^{rd} \text{ case is about a}$ [**Swedish** eCommerce H&M]

<hr>


Dear Readers,

# H&M Hennes & Mauritz AB

H&M is a Swedish company with 4801 market stores in 75 markets that owns brands namely: H&M, COS, Weekday, Monki, H&M Home, & Other Stories, ARKET, and Afound. She has 54 online markets representing 32% of the group's 2021's total revenues.

```{r, warning=FALSE, message=FALSE, echo=FALSE}

library(dplyr)
library(ggplot2)
library(ggthemes)
library(lubridate)

Articles <- read.csv("../input/h-and-m-personalized-fashion-recommendations/articles.csv", header = TRUE)
Customers <- read.csv("../input/h-and-m-personalized-fashion-recommendations/customers.csv", header = TRUE)
TransT <- read.csv("../input/h-and-m-personalized-fashion-recommendations/transactions_train.csv", header = TRUE)

```

# H&M’s initiatives

## The known knowns

In **H&M’s 2021’s full year report** it has been mentioned that they have tried to blur the differences in customer experiences between their physical stores and their online market places . They named it under the initiative of **improved customer experiences**. These initiatives offered to customers are given below:

- H&M’s Customer Loyalty programme
- More option payments
- Digital receipts
- Visual search
- Next day delivery and express delivery
- Climate smart delivery options
- Find in store
- Scan & Buy
- In—Store Mode
- #HMxME
- Size Guide
- Rate & Review
- RFID
- Self—service checkouts
- Instagram
- H&M HOME X Augmented Reality
- Rental in Store
- Styleboard 

These initiatives made us think about the given data in different light. 

## The known unknowns

On Kaggle they have made their data public for brand H&M. The online market place’s data is from 20 September 2018 up till 19 September 2020 i.e. 24 months of data. Based on this information **we cannot infer** the following parameters.

- The data is from their exclusive market place or from PAAS market places.
- The number of stores or online market places covered by this data.
- The geographic region from which the data is lifted.
- The currency in which the transactions have taken place.

# Feature Engineering

```{r, warning=FALSE, message=FALSE, echo=FALSE}

TransT <- mutate(TransT, WD = weekdays(as.Date(TransT$t_dat)))
TransT <- mutate(TransT, WNo = week(as.Date(TransT$t_dat)))
TransT <- mutate(TransT, Yr = year(as.Date(TransT$t_dat)))
TransT <- mutate(TransT, Mo = month(as.Date(TransT$t_dat)))
TransT <- mutate(TransT, Qu = quarter(TransT$t_dat, with_year = TRUE))

Tta <- left_join(TransT, Articles, by = "article_id")
```

```{r, warning=FALSE, fig.align='center', fig.height=8, message=FALSE, echo=FALSE}

Tta %>% select_at(vars(garment_group_name, WD)) %>% 
  arrange_at(vars(garment_group_name, WD)) %>%
  count_(vars(garment_group_name, WD)) %>%
  ggplot(aes(x = 1, y = as.factor(garment_group_name), label = n))+
  geom_text(size = 2.75, vjust =0, hjust =1)+
  theme_tufte()+
  scale_x_continuous(breaks = c(0, 0.25, 0,5, 0,75, 1, 1.25))+
  facet_grid(.~reorder(WD, desc(WD)))+
  labs(x = "Number of Units sold", y = "Garment's Group's Name", title = "Number of Units per Weekday")+
  theme(axis.text.x = element_text(size = 0.25, color = "white"),
        panel.grid.major.y = element_line(color = "grey", linetype = 3))
    
```

It's a work in progress. Hope you enjoy reading it.

Please do upvote if you like it.

Thanks 

Wish you Best

Anshuman MOUDGIL
