6111123, 9:24 PM
In [4]: import pandas as pd
import numpy as np
Iphone sales analysis -Jupyter Notebook
import plotly.express as px
import plotly.graph_objects as go
In [5]: data = pd.read_csv(“apple_products.csv")
print(data.head())
RUNHS
@ https: //www.flipkart.com/apple-iphone-8-plus-g... (https: //www.flipkart.
Product Name \
m/apple-iphone-8-plus-g...) Apple
1 https: //www.flipkart
m/apple-iphone-8-plus-s
Yea. flipkart.
m/apple-iphone-8-plus-s
ww. flipkart.
/apple-iphone-8-silver
ww. flipkart.
m/apple-iphone-8-gold-2
2 https:
3 https:
4 https:
APPLE iPhone 8 Plus (Gold, 64 GB)
APPLE iPhone 8 Plus (Space Grey,
APPLE iPhone 8 Plus (Silver,
APPLE iPhone 8 (Silver,
APPLE iPhone 8 (Gold,
256 GB)
256 GB)
256 GB)
256 GB)
Product URL Brand Sale Price \
49900
con/apple-iphone-8-plus-s
+) Apple 84900
con/apple-iphone-8-plus-s
-) Apple 84900
-con/apple-iphone-8-silver.
-) Apple 77000
-con/apple-iphone-8-gold-2...
-) Apple 7008
Mrp Discount Percentage Number Of Ratings
49900
84900
84900
77008
77000
RUNS
Upe
MOBEXRGV7EHHTGUH
MOBEXRGVACGTITAF
MOBEXRGVGETABXWZ
MOBEXRGVMZWUHCBA
MOBEXRGVPK7PFEIZ
RUNS
coooe
Star Rating
4.6
Baas
Ram
268
2 6B
2 6B
2B
2 6B
3431
3431
3431
11202
11202
cee (https://www.flipkart.
ses (bttps://wiw.flipkart.
Number OF Reviews \
356
356
356
794
794
(https: //www. flipkart.
(https: //www. flipkart.
Before moving forward, let's have a quick look at whether this dataset contains any null values
or not:
localhost 8889inotebooks/Documents/Untiled Foldr/swati programs/Youtube 30 days pylhoniphone sales analysis ipynb
wr911123, 924 Pm iphone sales analysis -Jupyter Notebook
In [6]: print(data.isnul1().sum())
Product Name
Product URL
Brand
Sale Price
Mp
Discount Percentage
Number Of Ratings
Number Of Reviews
upc
star Rating
Ram
dtype: intea
eseces0s000
The dataset doesn't have any null values, Now, let's have a look at the descriptive statistics of
the data:
In [7]: print(data.describe())
Sale Price Mrp Discount Percentage Number Of Ratings
\
count, 62.000000 62.000000 62.000000 62.000000
mean 80073.887097 88058.064516 9.951613 22420 .403226
std 34310.446132 34728.825597 7.608079 33768589550
min 29999.@e¢¢@@ © 39900.e00000 2.200000 542.000000
25% -49900.e00000 © 54900. 000000 6.000000 740.0000
50%
[email protected] 79900. 000000 10.000000 2101.000000
75% 117100.eeee@ 120950.e00000 14,000000 43470.200000
max
[email protected]@@¢¢@ 149900. 000000 29.000000 95909. 2¢0000
Number Of Reviews Star Rating
count 62.000008 62. 900008
mean 1861.677419 4.575806
std 2855.883830 0.059190
min 42.000088 © 4, 5¢e800
25% 64.00000a © 4. 500000
50% 180.000008 © 4.600000
75K 3331.000000 © 4. 620000
max 8161.000000 4. 720000
iPhone Sales Analysis in India
Now | will create a new dataframe by storing all the data about the top 10 highest-rated iPhones
in India on Flipkart. It will help in understanding what kind of iPhones are liked the most in India:
localhost 8889inotebooks/Documents/Untiled Foldr/swali programs/Youtube 30 days pylhoniiphone sales analysis ipynb6111128, 324 PM Iphone sales analysis -Jupyter Notebook
In [8]: highest_rated = data.sort_values(by=["Star Rating"],
ascending-False)
highest_rated = highest_rated.head(1¢)
print(highest_rated[ ‘Product Name’ ])
28 APPLE iPhone 11 Pro Max (Midnight Green, 64 GB)
wv APPLE iPhone 11 Pro Max (Space Grey, 64 GB)
16 APPLE iPhone 11 Pro Max (Midnight Green, 256 GB)
4s APPLE iPhone 11 Pro Max (Gold, 64 GB)
4 APPLE iPhone 11 Pro Max (Gold, 256 GB)
e APPLE iPhone 8 Plus (Gold, 64 GB)
29 APPLE iPhone 12 (White, 128 GB)
32 APPLE iPhone 12 Pro Max (Graphite, 128 GB)
35 APPLE iPhone 12 (Black, 128 GB)
36 APPLE iPhone 12 (Blue, 128 GB)
Name: Product Name, dtype: object
Now let's have a look at the number of ratings of the highest-rated iPhones on Flipkart:
localhost 8889inotebooks/Documents/Untiled Foldr/swati programs/Youtube 30 days pylhonliphone sales analysis ipynb
a76111123, 9:24 PM
In [9]:
localhost 8889inotebooks/Documents/Untiled Foldr/swali programs/Youtube 30 days pylhoniiphone sales analysis ipynb
Iphone sales analysis -Jupyter Notebook
highest_rated[ "Product Name"].value_counts()
label = iphones. index
counts = highest_rated{ "Number Of Ratings"]
figure = px.bar(highest_rated, x=label,
y = counts,
title="Number of Ratings of Highest Rated iPhones")
Figure. show()
iphones
Number of Ratings of Highest Rated iPhones
309
2 200
5
3
= so00
dl
Fey Maye Miyg Vag Pg am
6g Egy Pp, Op, eg Cup gy Pip, Me
Png tng Pag Mn nore on rena e
Lap Lm a Ua Ua Bry. ay ay,
"my, Mg ig ig, ty, toy, Mtg
According to the above bar graph, APPLE iPhone 8 Plus (Gold, 64 GB) has the most ratings on
Flipkart. Now let's have a look at the number of reviews of the highest-rated iPhones on Flipkart:
an6111123, 9:24 PM
In [10]:
Iphone sales analysis -Jupyter Notebook
highest_rated[ "Product Name"].value_counts()
label = iphones. index
counts = highest_rated{ "Number Of Reviews]
figure = px.bar(highest_rated, x=label,
y = counts,
title="Number of Reviews of Highest Rated iPhones")
igure. show()
iphones
Number of Reviews of Highest Rated iPhones
g 300
2
3
&
= 200
5
g
E100
ong 4) 4 4 4s
Vay ey 4 VP, Pa = Pa
ip, iy” Si, em ip, Grp ‘Sip Cp ny
hong ma hang Phang Phan, Phan, hag, hog,
ap ag try tap Slay 8m day lap
oy ny" my ny Sie Why, Pro
Mo, Ma, Min, My, Ma, Coy, Meo.
APPLE iPhone 8 Plus (Gold, 64 GB) is also leading in the highest number of reviews on Flipkart
among the highest-rated iPhones in India, Now let's have a look at the relationship between the
sale price of iPhones and their ratings on Flipkart
localhost 8889inotebooks/Documents/Untiled Foldr/swali programs/Youtube 30 days pylhoniiphone sales analysis ipynb6111128, 324 PM Iphone sales analysis -Jupyter Notebook
In [11]: figure = px.scatter(data_frame = data, x="Number OF Ratings”,
‘Sale Price”, size="Discount Percentage”,
trendline="ols",
"Relationship between Sale Price and Number of Rating
figure. show()
Relationship between Sale Price and Number of Ratings of iPhone
140k
120k
100k
80k
Sale Price
60k
40k
There is a negative linear relationship between the sale price of iPhones and the number of
ratings. It means iPhones with lower sale prices are sold more in India. Now let's have a look at
the relationship between the discount percentage on iPhones on Flipkart and the number of
ratings:
Relationship Between Discount Percentage &
Number of ratings of iphone
localhost 8889inotebooks/Documents/Untiled Foldr/swali programs/Youtube 30 days pylhoniiphone sales analysis ipynb or6111128, 324 PM Iphone sales analysis -Jupyter Notebook
In [12]: figure = px.scatter(data_frame = data, x="Number OF Ratings",
Discount Percentage", size="Sale Price",
trendline="ols",
title="Relationship between Discount Percentage and Number
Figure. show()
Relationship between Discount Percentage and Number of Rating:
30
e
25
20 e
- 8 °
» 6
Discount Percentage
Summary
APPLE iPhone 8 Plus (Gold, 64 GB) was the most appreciated iPhone in India iPhones with
lower sale prices are sold more in India iPhones with high discounts are sold more in India
localhost 8889inotebooks/Documents/Untiled Foldr/swali programs/Youtube 30 days pylhoniiphone sales analysis ipynb
W