-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpricing_analysis.py
30 lines (23 loc) · 1 KB
/
pricing_analysis.py
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
import streamlit as st
import pandas as pd
import plotly.express as px
def app():
st.title("*:green[Pricing Analysis]*")
# Load dataset
df = pd.read_excel('Sims_4_Data_v1.xlsx')
# Data Preprocessing
df['Release Date'] = pd.to_datetime(df['Release Date'])
df['Price'] = pd.to_numeric(df['Origin/ Official Price (USD)'], errors='coerce')
# Line Chart for Price Trends Over Time
st.subheader("Price Trends Over Time")
fig = px.line(df, x='Release Date', y='Price', color='Type',
title='Price Trends of Sims 4 DLCs Over Time')
st.plotly_chart(fig)
# Bar Chart for Most/Least Expensive DLCs
st.subheader("Most and Least Expensive DLCs")
expensive_dlc = df.sort_values(by='Price', ascending=False).head(5)
cheap_dlc = df.sort_values(by='Price', ascending=True).head(5)
st.write("**Most Expensive DLCs**")
st.table(expensive_dlc[['Title', 'Price']])
st.write("**Least Expensive DLCs**")
st.table(cheap_dlc[['Title', 'Price']])