laverdes commited on
Commit
85902d5
1 Parent(s): 16621db

feat: new page template for Plotting

Browse files
Files changed (1) hide show
  1. pages/1_📈_Plotting.py +37 -1
pages/1_📈_Plotting.py CHANGED
@@ -1,3 +1,39 @@
1
  import streamlit as st
 
2
 
3
- st.warning("We are working on this functionality!")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
+ import pandas as pd
3
 
4
+
5
+ st.header("Plotting Time-Series Data")
6
+ st.markdown("Users can load their time-series data in **.csv** format and select particular feature and plot-type to visualize it.\
7
+ Go ahead and use the sidebar on the left to upload your data files and to start visualizing it!")
8
+ st.caption("Upload your data using the sidebar to start and select a plot-type to start :sunglasses:")
9
+
10
+
11
+ def plot_collection(plot_only_this, collection, number_of_desired_plots=0):
12
+ fig = go.Figure()
13
+ plots_count = 0
14
+ print("total number of graphs: ", len(collection))
15
+
16
+ for (pattern_name, d) in collection:
17
+ if pattern_name == plot_only_this:
18
+ if plots_count ==0:
19
+ fig.add_trace(go.Line(y=d))
20
+ fig.update_layout(title=plot_only_this)
21
+ else:
22
+ fig.add_trace(go.Line(y=d))
23
+ plots_count += 1
24
+ fig.update_layout(width=1200, height=800)
25
+ if number_of_desired_plots:
26
+ if plots_count == number_of_desired_plots:
27
+ break
28
+
29
+
30
+ with st.sidebar:
31
+ plot = st.radio("Select the kind of visualization:",('Plot feature', 'Compare users', 'Plot distribution'))
32
+ file = st.file_uploader("Load CSV file", accept_multiple_files = False)
33
+ if file:
34
+ df = pd.read_csv(file)
35
+ if 'df' not in st.session_state:
36
+ st.session_state['df'] = df
37
+
38
+ if 'df' in list(st.session_state.keys()):
39
+ st.dataframe(st.session_state.df)