File size: 2,667 Bytes
c37aafe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import numpy as np
import pandas as pd

import os
for dirname, _, filenames in os.walk('/kaggle/input'):
  for filename in filenames:
    print(os.path.join(dirname, filename))

# Commented out IPython magic to ensure Python compatibility.
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# %matplotlib inline
import seaborn as sns
import warnings
warnings.filterwarnings('ignore')

df=pd.read_csv('/content/Amazon Sale Report.csv')
df.shape

df.head()

df.tail()

df.info()

df.drop(['New', 'PendingS'], axis=1, inplace=True)

df.info()

pd.isnull(df)

pd.isnull(df).sum()

df.shape

df.dropna(inplace=True)
df.shape

df.shape

df.columns

df['ship-postal-code']=df['ship-postal-code'].astype('int')

df['ship-postal-code'].dtype

df['Date']=pd.to_datetime (df['Date'])

df.columns

df.rename(columns={'Qty':'Quantity'})

df.describe()

df.describe(include='object')

df[['Qty','Amount']].describe()

df.columns

ax=sns.countplot(x='Size', data=df)

ax=sns.countplot(x='Size', data=df)

for bars in ax.containers:
  ax.bar_label(bars)

df.groupby(['Size'], as_index=False)['Qty'].sum().sort_values(by='Qty',ascending=False)

S_Qty=df.groupby(['Size'], as_index=False)['Qty'].sum().sort_values(by='Qty', ascending=False)

sns.barplot(x='Size', y='Qty', data=S_Qty)

sns.countplot(data=df, x='Courier Status', hue='Status')

plt.figure(figsize=(10, 5))

ax=sns.countplot(data=df, x='Courier Status', hue='Status')
plt.show()

df['Size'].hist()

df['Category'] = df['Category'].astype(str)
column_data = df['Category']
plt.figure(figsize=(10, 5))
plt.hist(column_data, bins=10, edgecolor='Black')
plt.xticks(rotation=90)
plt.show()

B2B_Check = df['B2B'].value_counts()
plt.pie(B2B_Check, labels=B2B_Check, autopct='%1.1f%%')
plt.show()

B2B_Check = df['B2B'].value_counts()
plt.pie(B2B_Check, labels=B2B_Check.index, autopct='%1.1f%%')
plt.show

a1 = df['Fulfilment'].value_counts()
fig, ax = plt.subplots()
ax.pie(a1, labels=a1.index, autopct='%1.1f%%', radius=0.7, wedgeprops=dict(width=0.6))
ax.set(aspect="equal")
plt.show()

x_data = df['Category']
y_data = df['Size']

plt.scatter(x_data, y_data)
plt.xlabel('Category')
plt.ylabel('Size')
plt.title('Scatter Plot')
plt.show()

plt.figure(figsize=(12, 6))
sns.countplot(data=df, x='ship-state')
plt.xlabel('ship-state')
plt.ylabel('count')
plt.title('Distribution of State')
plt.xticks(rotation=90)
plt.show()

top_10_state = df['ship-state'].value_counts().head(10)
plt.figure(figsize=(12, 6))
sns.countplot(data=df[df['ship-state'].isin(top_10_state.index)], x='ship-state')
plt.xlabel('ship-state')
plt.ylabel('count')
plt.title('Distribution of State')
plt.xticks(rotation=45)
plt.show()