Amazon Price Tracker

Mon 30 June 2025
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
df = pd.read_csv(r'C:\Users\HP\Desktop\amazon_products.csv')
df
Product Price Rating Reviews
0 Bluetooth Earphones 1599 4.2 1532
1 Smartphone Cover 299 4.0 412
2 Wireless Mouse 649 4.4 845
3 LED Monitor 10499 4.5 135
4 Keyboard 999 4.1 675
5 Phone Tripod 749 4.3 238
6 Portable SSD 5499 4.7 324
7 USB Hub 799 4.2 147
8 Webcam 2399 4.1 510
9 Laptop Stand 1499 4.3 289
df.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 10 entries, 0 to 9
Data columns (total 4 columns):
 #   Column   Non-Null Count  Dtype  
---  ------   --------------  -----  
 0   Product  10 non-null     object 
 1   Price    10 non-null     int64  
 2   Rating   10 non-null     float64
 3   Reviews  10 non-null     int64  
dtypes: float64(1), int64(2), object(1)
memory usage: 452.0+ bytes
df.describe()
Price Rating Reviews
count 10.000000 10.000000 10.000000
mean 2499.000000 4.280000 510.700000
std 3184.772798 0.209762 424.702262
min 299.000000 4.000000 135.000000
25% 761.500000 4.125000 250.750000
50% 1249.000000 4.250000 368.000000
75% 2199.000000 4.375000 633.750000
max 10499.000000 4.700000 1532.000000
deals = df[df["Price"] <= 1000].sort_values("Price")
deals
Product Price Rating Reviews
1 Smartphone Cover 299 4.0 412
2 Wireless Mouse 649 4.4 845
5 Phone Tripod 749 4.3 238
7 USB Hub 799 4.2 147
4 Keyboard 999 4.1 675
top_reviews = df.sort_values("Reviews", ascending=False).head(5)
top_reviews
Product Price Rating Reviews
0 Bluetooth Earphones 1599 4.2 1532
2 Wireless Mouse 649 4.4 845
4 Keyboard 999 4.1 675
8 Webcam 2399 4.1 510
1 Smartphone Cover 299 4.0 412
plt.figure(figsize=(10,6))
sns.scatterplot(data=df, x="Rating", y="Price", size="Reviews", hue="Product", legend=False)
plt.title("Product Price vs Rating")
plt.xlabel("Rating")
plt.ylabel("Price")
plt.grid(True)
plt.show()

png

sns.scatterplot(data=df, x="Rating", y="Price", size="Reviews", hue="Product", legend=False)
plt.title("Product Price vs Rating")
plt.xlabel("Rating")
plt.ylabel("Price")
plt.grid(True)
plt.show()

png

plt.figure(figsize=(8,5))
sns.histplot(df["Rating"], bins=5, kde=True, color='skyblue')
plt.title("Distribution of Product Ratings")
plt.xlabel("Rating")
plt.ylabel("Number of Products")
plt.grid(True)
plt.show()

png

df["Price_per_rating"] = df["Price"] / df["Rating"]
df.sort_values("Price_per_rating")
Product Price Rating Reviews Price_per_rating
1 Smartphone Cover 299 4.0 412 74.750000
2 Wireless Mouse 649 4.4 845 147.500000
5 Phone Tripod 749 4.3 238 174.186047
7 USB Hub 799 4.2 147 190.238095
4 Keyboard 999 4.1 675 243.658537
9 Laptop Stand 1499 4.3 289 348.604651
0 Bluetooth Earphones 1599 4.2 1532 380.714286
8 Webcam 2399 4.1 510 585.121951
6 Portable SSD 5499 4.7 324 1170.000000
3 LED Monitor 10499 4.5 135 2333.111111


Score: 10

Category: pandas-work