<jupyter_start><jupyter_text>Problem Statement Tasks -1. Perform Exploratory Data Analysis2. Create A Sales Dashboard in Tableau/ Power BISituation - You are the sales manager of the store and you have to take certain actions which will increase the probable sales of the store. Mention 5 such actions and the actions should be backed by the data provided.Also, analyze the YOY performance of the store Eg. Find your most valuable customers and their avg order size so that you can give optimum discounts to them because according to the Pareto principle 80% of sales comes from 20% of loyal customers.Ask significant Business Questions and try to find data-backed answers.<jupyter_code>import pandas as pd
import seaborn as sns
import numpy as np 
import matplotlib.pyplot as plt 
%matplotlib inline
import warnings
warnings.filterwarnings('ignore')
df_train = pd.read_csv(r'C:\Users\Personal\OneDrive\Documents\Jupyter Notebook\Project_Subhodeep da\train - train.csv')
df_train.head()
df_train.isnull().sum()
df_train.info()
df_train.describe()
df_train.head()
import datetime
df_train['year'] = pd.DatetimeIndex(df_train['Order Date']).year
df_train['month'] = pd.DatetimeIndex(df_train['Order Date']).month
df_train.head()
df_train.year.value_counts()
df_train.info()<jupyter_output><class 'pandas.core.frame.DataFrame'>
RangeIndex: 9800 entries, 0 to 9799
Data columns (total 20 columns):
 #   Column         Non-Null Count  Dtype  
---  ------         --------------  -----  
 0   Row ID         9800 non-null   int64  
 1   Order ID       9800 non-null   object 
 2   Order Date     9800 non-null   object 
 3   Ship Date      9800 non-null   object 
 4   Ship Mode      9800 non-null   object 
 5   Customer ID    9800 non-null   object 
 6   Customer Name  9800 non-null   object 
 7   Segment        9800 non-null   object 
 8   Country        9800 non-null   object 
 9   City           9800 non-null   object 
 10  State          9800 non-null   object 
 11  Postal Code    9789 non-null   float64
 12  Region         9800 non-null   object 
 13  Product ID     9800 non-null   object 
 14  Category       9800 non-null   object 
 15  Sub-Category   9800 non-null   object 
 16  Product Name   9800 non-null   object 
 17  Sales          9800 non-null   float64
 18  year    [...]<jupyter_text>Visualising Sales month by month<jupyter_code>sns.barplot(x='month', y='Sales',data=df_train, palette='summer')
plt.xlabel('Months')
plt.ylabel('Sales')<jupyter_output><empty_output><jupyter_text>Inference:1. During start of the years, the sale is comparatively higher.2. The sale on month of August is more than it's neighbouring months.   Visualising sales Year by Year<jupyter_code>sns.barplot(x=df_train['year'], y=df_train['Sales'],data=df_train,palette='summer')
plt.xlabel('Years')
plt.ylabel('Sales')<jupyter_output><empty_output><jupyter_text>Inferences:1. The sales have dropped in 2016 and 20182. The highest sale was on 2015 and lowest on 2018<jupyter_code>df_train['Category'].unique()
df_cat=df_train.groupby(['Category']).sum().reset_index()
df_cat<jupyter_output><empty_output><jupyter_text>Visualising Sales according to Category<jupyter_code>plt.figure(figsize=(18,8))
colors = sns.color_palette('crest')[1:5]
plt.pie(x= df_cat['Sales'], labels=df_cat['Category'], explode=[0.1,0.1,0.1], colors=colors, autopct='%1.4f%%')<jupyter_output><empty_output><jupyter_text>Inferences:1. Technology is the most bought category of products, followed by Furniture and Office Supplies.  Top 5 cities according to Cities<jupyter_code>df_train['City'].unique()
df_cit=df_train.groupby(['City']).sum().reset_index()
df_cit
df_cit.sort_values(by=['Sales'], ascending=False, inplace=True)
df_cit.head(10)
explode = (0.05, 0.05, 0.05, 0.05, 0.05)
plt.figure(figsize=(18,8))
colors = sns.color_palette('viridis')[1:6]
plt.pie(df_cit['Sales'][:5], labels= df_cit['City'][:5],autopct='%1.4f%%', pctdistance=0.85,explode=explode,colors=colors)
centre_circle = plt.Circle((0, 0), 0.70, fc='white')
fig = plt.gcf()
  
# Adding Circle in Pie chart
fig.gca().add_artist(centre_circle)<jupyter_output><empty_output><jupyter_text>Inferences1. The sale in New York City is the highest, followed by Los Angeles.2. The 3rd,4th and 5th city(ranked according to sales) are as follows: Seattle,San Fransisco,Philadelphia<jupyter_code>df_train.head(2)
df_train['Customer ID'].nunique()
df_cus=df_train.groupby(['Customer ID']).sum().reset_index()
df_cus.sort_values(by=['Sales'], ascending=False, inplace=True)
df_cus.head(10)
plt.figure(figsize=(18,8))
colors = sns.color_palette('flare')
plt.pie(df_cus['Sales'][:10], labels= df_cus['Customer ID'][:10],pctdistance=0.85,colors=colors,autopct='%1.4f%%')
centre_circle = plt.Circle((0, 0), 0.70, fc='white')
fig = plt.gcf()
  
# Adding Circle in Pie chart
fig.gca().add_artist(centre_circle)<jupyter_output><empty_output><jupyter_text>Inferences:1.The list of top 10 customers is shown above.<jupyter_code>df_train["Category"]=df_train["Category"].map({'Furniture':1,'Office Supplies':2,'Technology':3})
df_train.head()
sns.barplot('year','Sales',hue='Category',data=df_train,palette="magma")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12594458438287154, 'fraction_numerical': 0.04340244138732804, 'mean_word_length': 4.906178489702517, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '219282', 'license': 'MIT', 'n_tokens_mistral': 1934, 'n_tokens_neox': 1743, 'n_words': 452, 'path': 'EDA using Python/Sales Analysis of a Company.ipynb', 'repo_name': 'Tan7im/Data-Science-Cohort', 'size': '5161'}