Update pages/3_EDA_and_Feature_Engineering.py
Browse files
pages/3_EDA_and_Feature_Engineering.py
CHANGED
|
@@ -281,17 +281,21 @@ if df is not None:
|
|
| 281 |
st.pyplot(fig)
|
| 282 |
|
| 283 |
st.markdown('''**Insights:**
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
|
|
|
|
|
|
|
|
|
| 293 |
''')
|
| 294 |
|
|
|
|
| 295 |
fig, axs = plt.subplots(1, 3, figsize=(18*0.7, 6*0.7))
|
| 296 |
axs = axs.flatten() # Flatten the 2D array of axes to easily index
|
| 297 |
|
|
@@ -318,12 +322,13 @@ if df is not None:
|
|
| 318 |
st.pyplot(fig)
|
| 319 |
|
| 320 |
st.markdown('''**Insights:**
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
''')
|
| 326 |
|
|
|
|
| 327 |
|
| 328 |
st.write("### PRODUCT VS BRANDS")
|
| 329 |
# Create the plot
|
|
@@ -366,19 +371,24 @@ if df is not None:
|
|
| 366 |
# Render the plot in Streamlit
|
| 367 |
st.plotly_chart(fig)
|
| 368 |
st.markdown('''**Insights:**
|
| 369 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 370 |
|
| 371 |
-
|
| 372 |
|
| 373 |
-
|
| 374 |
-
2. **Smart Watches (Red)**: Show a relatively consistent distribution across the price range, though perhaps slightly more prevalent in the mid-range.
|
| 375 |
-
3. **Tablets (Yellow)**: Seem to be more common in the mid-price range, with fewer tablets at both the low and high ends.
|
| 376 |
-
4. **Laptops (White)**: Tend to dominate the higher price ranges, as expected. There are very few laptops at the lower price points.
|
| 377 |
-
5. **Headphones (Light Blue)**: Have a fairly even distribution across the price range, although there's a slight increase in the mid-to-high price range.
|
| 378 |
|
| 379 |
-
|
|
|
|
|
|
|
| 380 |
''')
|
| 381 |
|
|
|
|
| 382 |
|
| 383 |
st.write("### BRANDS VS PRICE")
|
| 384 |
# Create the histogram plot
|
|
@@ -388,23 +398,24 @@ if df is not None:
|
|
| 388 |
# Render the plot in Streamlit
|
| 389 |
st.plotly_chart(fig)
|
| 390 |
st.markdown('''**Insights:**
|
| 391 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 392 |
|
| 393 |
-
|
| 394 |
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
|
| 399 |
-
3. **Sony (Lighter Purple)**: Seems to be more concentrated in the mid-to-high price range.
|
| 400 |
-
|
| 401 |
-
4. **Samsung (Lightest Purple/Pink)**: Has a presence across the price range, but seems to be more prominent in the mid-range and slightly lower-mid range.
|
| 402 |
-
|
| 403 |
-
5. **Other Brands (Darkest Purple/Blue, sometimes hard to distinguish from Apple)**: This category seems to have a substantial presence across all price points, particularly at the lower end. This suggests a large variety of less prominent brands catering to different price segments.
|
| 404 |
|
| 405 |
-
|
|
|
|
|
|
|
| 406 |
''')
|
| 407 |
|
|
|
|
| 408 |
|
| 409 |
st.write("### AGE vs PRODUCT CATEGORY and PRICE")
|
| 410 |
# Create the histogram plot
|
|
@@ -413,25 +424,26 @@ if df is not None:
|
|
| 413 |
# Render the plot in Streamlit
|
| 414 |
st.plotly_chart(fig)
|
| 415 |
st.markdown('''**Insights:**
|
| 416 |
-
|
|
|
|
|
|
|
| 417 |
|
| 418 |
-
|
| 419 |
-
|
| 420 |
-
2. **Smart Watches (Red)**: Show a notable presence, with potentially higher contributions in the younger and middle-age groups. This could indicate that smartwatches are more popular among these demographics.
|
| 421 |
-
|
| 422 |
-
3. **Tablets (Green)**: Have a somewhat consistent demand across age groups, similar to smartphones but with a smaller overall contribution to total orders.
|
| 423 |
-
|
| 424 |
-
4. **Laptops (Purple)**: Appear to have a strong presence across all age groups, often rivaling or exceeding smartphones in contribution. This suggests laptops are essential for a wide range of ages.
|
| 425 |
-
|
| 426 |
-
5. **Headphones (Orange)**: Show a relatively consistent pattern across age groups, with a moderate contribution to total orders.
|
| 427 |
|
| 428 |
-
|
| 429 |
|
| 430 |
-
|
| 431 |
-
|
| 432 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 433 |
''')
|
| 434 |
|
|
|
|
| 435 |
|
| 436 |
st.write("### HEATMAP | CORRELATION MATRIX")
|
| 437 |
st.write("#### Label Encoding")
|
|
|
|
| 281 |
st.pyplot(fig)
|
| 282 |
|
| 283 |
st.markdown('''**Insights:**
|
| 284 |
+
|
| 285 |
+
- **Category Distribution**: The distribution of products across categories (Smartphones, Smart Watches, Tablets, Laptops, Headphones) is relatively uniform, with slight variations. This suggests a diverse product catalog.
|
| 286 |
+
|
| 287 |
+
- **Purchase Intent**: It appears that "Purchase Intent = 1" (meaning intent to purchase is present) is fairly consistent across categories, with no category showing a significantly higher or lower proportion of purchase intent.
|
| 288 |
+
|
| 289 |
+
- **Brand Distribution**: The distribution of brands is less uniform. "Other Brands" seems to have the highest representation, followed by Samsung, Sony, HP, and then Apple.
|
| 290 |
+
|
| 291 |
+
- **Purchase Intent**: Observe if there are any notable differences in the proportion of "Purchase Intent = 1" between different brands. This could indicate if certain brands are more desirable or effective at converting interest into purchases.
|
| 292 |
+
|
| 293 |
+
- **Price Distribution**: The price histogram indicates a wide range of product prices, likely spanning from near 0 to 3000 (assuming the x-axis represents price).
|
| 294 |
+
|
| 295 |
+
- **Purchase Intent**: Examine how purchase intent varies across different price points. Are there price ranges where purchase intent is higher or lower? This could reveal price sensitivity or the effectiveness of pricing strategies.
|
| 296 |
''')
|
| 297 |
|
| 298 |
+
|
| 299 |
fig, axs = plt.subplots(1, 3, figsize=(18*0.7, 6*0.7))
|
| 300 |
axs = axs.flatten() # Flatten the 2D array of axes to easily index
|
| 301 |
|
|
|
|
| 322 |
st.pyplot(fig)
|
| 323 |
|
| 324 |
st.markdown('''**Insights:**
|
| 325 |
+
|
| 326 |
+
- **Uneven Distribution**: There's a significant difference in the number of customers in each gender category. The category represented by '1' (likely female) has a much higher count than the category represented by '0' (likely male). This indicates that your customer base is skewed towards one gender.
|
| 327 |
+
|
| 328 |
+
- **Purchase Intent**: The proportion of "Purchase Intent = 1" (meaning the intent to purchase is present) appears to be relatively similar between the two genders. The purple bars (Purchase Intent = 1) are proportionally similar in height for both genders.
|
| 329 |
''')
|
| 330 |
|
| 331 |
+
|
| 332 |
|
| 333 |
st.write("### PRODUCT VS BRANDS")
|
| 334 |
# Create the plot
|
|
|
|
| 371 |
# Render the plot in Streamlit
|
| 372 |
st.plotly_chart(fig)
|
| 373 |
st.markdown('''**Insights:**
|
| 374 |
+
- **Price Range**: The x-axis shows a price range likely from 0 to 3000 (units unspecified, but presumably currency).
|
| 375 |
+
|
| 376 |
+
- **Category Distribution Across Price**: The stacked areas illustrate how the proportion of each product category varies across the price spectrum.
|
| 377 |
+
|
| 378 |
+
1. **Smartphones (Black)**: Appear to be concentrated in the lower to mid-price ranges, with fewer smartphones at the higher price points.
|
| 379 |
+
|
| 380 |
+
2. **Smart Watches (Red)**: Show a relatively consistent distribution across the price range, though perhaps slightly more prevalent in the mid-range.
|
| 381 |
|
| 382 |
+
3. **Tablets (Yellow)**: Seem to be more common in the mid-price range, with fewer tablets at both the low and high ends.
|
| 383 |
|
| 384 |
+
4. **Laptops (White)**: Tend to dominate the higher price ranges, as expected. There are very few laptops at the lower price points.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 385 |
|
| 386 |
+
5. **Headphones (Light Blue)**: Have a fairly even distribution across the price range, although there's a slight increase in the mid-to-high price range.
|
| 387 |
+
|
| 388 |
+
- **Overlapping Areas**: The stacked nature of the chart allows you to see the total number of products at each price point by summing the heights of the stacked areas.
|
| 389 |
''')
|
| 390 |
|
| 391 |
+
|
| 392 |
|
| 393 |
st.write("### BRANDS VS PRICE")
|
| 394 |
# Create the histogram plot
|
|
|
|
| 398 |
# Render the plot in Streamlit
|
| 399 |
st.plotly_chart(fig)
|
| 400 |
st.markdown('''**Insights:**
|
| 401 |
+
- **Price Range**: The x-axis covers a price range, likely from 0 to 3000 (currency unspecified).
|
| 402 |
+
|
| 403 |
+
- **Brand Distribution Across Price**: The stacked bars show the count of products from each brand within different price intervals.
|
| 404 |
+
|
| 405 |
+
1. **Apple (Darkest Purple/Blue)**: Appears to have a significant presence across most of the price range, though perhaps slightly less so at the very lowest end.
|
| 406 |
|
| 407 |
+
2. **HP (Medium Purple)**: Also has a fairly broad distribution across price points, with a noticeable presence in the mid-range.
|
| 408 |
|
| 409 |
+
3. **Sony (Lighter Purple)**: Seems to be more concentrated in the mid-to-high price range.
|
| 410 |
+
|
| 411 |
+
4. **Samsung (Lightest Purple/Pink)**: Has a presence across the price range, but seems to be more prominent in the mid-range and slightly lower-mid range.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 412 |
|
| 413 |
+
5. **Other Brands (Darkest Purple/Blue, sometimes hard to distinguish from Apple)**: This category seems to have a substantial presence across all price points, particularly at the lower end. This suggests a large variety of less prominent brands catering to different price segments.
|
| 414 |
+
|
| 415 |
+
- **Overlapping Areas/Stacked Bars**: The stacked nature of the chart shows the total number of products at each price point by adding up the heights of the different brand segments.
|
| 416 |
''')
|
| 417 |
|
| 418 |
+
|
| 419 |
|
| 420 |
st.write("### AGE vs PRODUCT CATEGORY and PRICE")
|
| 421 |
# Create the histogram plot
|
|
|
|
| 424 |
# Render the plot in Streamlit
|
| 425 |
st.plotly_chart(fig)
|
| 426 |
st.markdown('''**Insights:**
|
| 427 |
+
- **Category Distribution Across Age**: The stacked bars illustrate how the proportion of each product category contributes to the total orders within each age group.
|
| 428 |
+
|
| 429 |
+
1. **Smartphones (Blue)**: Appear to have a fairly consistent demand across all age groups, forming the base of most stacks. This suggests smartphones are a popular category regardless of age.
|
| 430 |
|
| 431 |
+
2. **Smart Watches (Red)**: Show a notable presence, with potentially higher contributions in the younger and middle-age groups. This could indicate that smartwatches are more popular among these demographics.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 432 |
|
| 433 |
+
3. **Tablets (Green)**: Have a somewhat consistent demand across age groups, similar to smartphones but with a smaller overall contribution to total orders.
|
| 434 |
|
| 435 |
+
4. **Laptops (Purple)**: Appear to have a strong presence across all age groups, often rivaling or exceeding smartphones in contribution. This suggests laptops are essential for a wide range of ages.
|
| 436 |
+
|
| 437 |
+
5. **Headphones (Orange)**: Show a relatively consistent pattern across age groups, with a moderate contribution to total orders.
|
| 438 |
+
|
| 439 |
+
- **Insights**:
|
| 440 |
+
|
| 441 |
+
1. **Age-Related Preferences**: While some categories like smartphones and laptops seem to have broad appeal, there are hints of age-related preferences. For example, smartwatches might be more popular among younger demographics.
|
| 442 |
+
|
| 443 |
+
2. **Dominant Categories**: Smartphones and laptops appear to be the most consistently popular categories across most age groups.
|
| 444 |
''')
|
| 445 |
|
| 446 |
+
|
| 447 |
|
| 448 |
st.write("### HEATMAP | CORRELATION MATRIX")
|
| 449 |
st.write("#### Label Encoding")
|