<jupyter_start><jupyter_text>Import modules and fetch dataset<jupyter_code>import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

df = pd.read_csv("/content/SampleSuperstore.csv")
df<jupyter_output><empty_output><jupyter_text>Some insights on the data<jupyter_code>df.describe()
# Checking how much rows and columns are there in the dataset.
df.shape
df.info()
df.nunique() # Checking the unique entries<jupyter_output><empty_output><jupyter_text>Data Cleaning<jupyter_code>df.isnull().sum() # Check for null values
if df.duplicated().sum() > 0:
  df.drop_duplicates(keep="first", inplace=True)
df.shape
df["Country"].value_counts()
# We can drop the country as it has same value in all columns
df.drop("Country", axis=1, inplace=True)
df
# Dropping Ship Mode Column as it seems not very helpful
df.drop("Ship Mode", axis=1, inplace=True)
df<jupyter_output><empty_output><jupyter_text>**Heatmap (We can see the correlation between all the numerical features of the dataset)**<jupyter_code>plt.style.use('fivethirtyeight')
# Correlation Matrix
corr_matrix = df.corr()
sns.heatmap(corr_matrix, annot=True)
plt.figure(figsize=(5, 4))
sns.countplot(x=df['Segment'])
plt.figure(figsize=(5, 4))
sns.countplot(x=df['Category'])<jupyter_output><empty_output><jupyter_text>**Profit Distribution by Region**<jupyter_code>sns.barplot(x='Region',y='Profit' ,hue='Category', data=df, palette='Set2')
plt.legend(loc='best')<jupyter_output><empty_output><jupyter_text>We can see from above plot that the loss is in the category of Furniture **Discount Rates By Region**<jupyter_code>sns.barplot(x='Region',y='Discount', hue='Category', data=df, palette='Set2')
plt.legend(loc='best')<jupyter_output><empty_output><jupyter_text>**Profit and Sales Across Categories**<jupyter_code>plt.figure(figsize=(16, 8))
df.groupby("Category")["Profit", "Sales"].agg(sum).sort_values(by='Sales', ascending=False).plot.bar()
plt.title('Profit and Sales Across Categories')<jupyter_output>/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:2: FutureWarning: Indexing with multiple keys (implicitly converted to a tuple of keys) will be deprecated, use a list instead.<jupyter_text>**Profit and Sales Across Sub-Categories**<jupyter_code>plt.figure(figsize=(16, 8))
df.groupby("Sub-Category")["Profit", "Sales"].agg(sum).sort_values(by='Sales', ascending=False).plot.bar()
plt.title('Profit and Sales Across Sub-Categories')<jupyter_output>/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:3: FutureWarning: Indexing with multiple keys (implicitly converted to a tuple of keys) will be deprecated, use a list instead.
  This is separate from the ipykernel package so we can avoid doing imports until<jupyter_text>**Profit and Sales Across States**<jupyter_code>df.groupby("State")["Profit", "Sales"].agg(sum).sort_values(by='Sales', ascending=False).plot.bar()
plt.title('Profit and Sales Across States')<jupyter_output>/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:2: FutureWarning: Indexing with multiple keys (implicitly converted to a tuple of keys) will be deprecated, use a list instead.
{'fraction_non_alphanumeric': 0.13616071428571427, 'fraction_numerical': 0.007653061224489796, 'mean_word_length': 7.988538681948424, 'pattern_counts': {'":': 0, '<': 34, '<?xml version=': 0, '>': 35, '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': '9', 'dir': 'jupyter-structured-clean-dedup', 'id': '641585', 'license': 'MIT', 'n_tokens_mistral': 1108, 'n_tokens_neox': 1052, 'n_words': 251, 'path': 'Datascience_With_Python/Data Analysis and Visualization/Videos/Exploratory Data Analysis/exploratory_data_analysis_on_superstore_data.ipynb', 'repo_name': 'vishnupriya129/winter-of-contributing', 'size': '3136'}