ARBAJSSHAIKH commited on
Commit
16e1a4d
·
verified ·
1 Parent(s): 259b0e8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -22
app.py CHANGED
@@ -1,30 +1,42 @@
1
  import streamlit as st
2
  import pandas as pd
3
  import matplotlib.pyplot as plt
4
- import numpy as np
5
 
6
- # Load the CSV data
7
- file_path = "important5years.csv"
8
- df = pd.read_csv(file_path)
9
- df.set_index("Shop Code", inplace=True)
 
 
10
 
11
  # Streamlit app
12
- st.title("5 Years of Genericart Franchises Sales Report")
13
- st.set_option('deprecation.showPyplotGlobalUse', False)
14
- # Dropdown for selecting an index
15
- selected_index = st.selectbox("Select an index:", df.index)
 
 
 
16
 
17
- # Submit button
 
18
  if st.button("Submit"):
19
- # Plotting
20
- plt.figure(figsize=(10, 6))
21
- plt.bar(df.columns, df.loc[selected_index])
22
- plt.title(f"Sales Data for {selected_index}")
23
- plt.xlabel("Months")
24
- plt.ylabel("Sales Amount")
25
- plt.xticks(rotation=90, ha="right")
26
-
27
- # Show plot
28
- st.pyplot()
29
-
30
-
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
  import pandas as pd
3
  import matplotlib.pyplot as plt
 
4
 
5
+ # Load the monthly and yearly CSV data
6
+ monthly_file_path = "important5years.csv"
7
+ yearly_file_path = "important-Yearwise-5years.csv"
8
+
9
+ df_monthly = pd.read_csv(monthly_file_path)
10
+ df_yearly = pd.read_csv(yearly_file_path)
11
 
12
  # Streamlit app
13
+ st.title("GENERICART SALES TREND")
14
+
15
+ # Dropdown for selecting an index (Shop Code)
16
+ selected_index = st.selectbox("Select Shop Code:", df_monthly["Shop Code"].unique())
17
+
18
+ # Dropdown for selecting data type
19
+ selected_data_type = st.selectbox("Select Data Type:", ["Monthly", "Yearly"])
20
 
21
+
22
+ # Plotting
23
  if st.button("Submit"):
24
+ if selected_data_type == "Monthly":
25
+ df_selected = df_monthly[df_monthly["Shop Code"] == selected_index]
26
+ plt.figure(figsize=(10, 6))
27
+ plt.bar(df_selected.columns[1:], df_selected.iloc[0, 1:])
28
+ plt.title(f"Monthly Sales Data for Shop Code {selected_index}")
29
+ plt.xlabel("Months")
30
+ plt.ylabel("Sales Amount")
31
+ plt.xticks(rotation=90, ha="right")
32
+ st.pyplot()
33
+
34
+ elif selected_data_type == "Yearly":
35
+ df_selected = df_yearly[df_yearly["Shop Code"] == selected_index]
36
+ plt.figure(figsize=(10, 6))
37
+ plt.bar(df_selected.columns[1:], df_selected.iloc[0, 1:])
38
+ plt.title(f"Yearly Sales Data for Shop Code {selected_index}")
39
+ plt.xlabel("Years")
40
+ plt.ylabel("Sales Amount")
41
+ plt.xticks(rotation=90, ha="right")
42
+ st.pyplot()