Abu1998 commited on
Commit
7ce127e
·
verified ·
1 Parent(s): fb157f4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -4
app.py CHANGED
@@ -1,4 +1,7 @@
1
  import streamlit as st
 
 
 
2
  from dataset_import import load_data
3
 
4
  st.title("AnalyzeYT Dataset Analysis")
@@ -10,17 +13,41 @@ if data is not None:
10
  st.write("Loaded Data Preview:")
11
  st.write(data.head())
12
 
13
- # Add some basic analysis and visualization options
14
  st.write("Data Description:")
15
  st.write(data.describe())
16
 
 
 
 
 
 
 
 
 
17
  st.write("Data Visualization:")
18
  chart_type = st.selectbox("Select Chart Type", ['Line Chart', 'Bar Chart', 'Histogram'])
19
 
20
  if chart_type == 'Line Chart':
21
- st.line_chart(data)
 
 
 
 
 
22
  elif chart_type == 'Bar Chart':
23
- st.bar_chart(data)
 
 
 
 
 
24
  elif chart_type == 'Histogram':
25
  selected_column = st.selectbox("Select Column for Histogram", data.columns)
26
- st.write(data[selected_column].plot(kind='hist'))
 
 
 
 
 
 
 
1
  import streamlit as st
2
+ import pandas as pd
3
+ import seaborn as sns
4
+ import matplotlib.pyplot as plt
5
  from dataset_import import load_data
6
 
7
  st.title("AnalyzeYT Dataset Analysis")
 
13
  st.write("Loaded Data Preview:")
14
  st.write(data.head())
15
 
16
+ # Show data description
17
  st.write("Data Description:")
18
  st.write(data.describe())
19
 
20
+ # Add correlation matrix
21
+ st.write("Correlation Matrix:")
22
+ corr = data.corr()
23
+ st.write(corr)
24
+ st.write(sns.heatmap(corr, annot=True, cmap='coolwarm'))
25
+ st.pyplot()
26
+
27
+ # Data visualization options
28
  st.write("Data Visualization:")
29
  chart_type = st.selectbox("Select Chart Type", ['Line Chart', 'Bar Chart', 'Histogram'])
30
 
31
  if chart_type == 'Line Chart':
32
+ x_axis = st.selectbox("Select X-axis Column", data.columns)
33
+ y_axis = st.selectbox("Select Y-axis Column", data.columns)
34
+ title = st.text_input("Enter Chart Title", "Line Chart")
35
+ st.line_chart(data[[x_axis, y_axis]])
36
+ st.write(f"Line Chart: {title}")
37
+
38
  elif chart_type == 'Bar Chart':
39
+ x_axis = st.selectbox("Select X-axis Column", data.columns)
40
+ y_axis = st.selectbox("Select Y-axis Column", data.columns)
41
+ title = st.text_input("Enter Chart Title", "Bar Chart")
42
+ st.bar_chart(data[[x_axis, y_axis]])
43
+ st.write(f"Bar Chart: {title}")
44
+
45
  elif chart_type == 'Histogram':
46
  selected_column = st.selectbox("Select Column for Histogram", data.columns)
47
+ bins = st.slider("Number of Bins", min_value=10, max_value=100, value=30)
48
+ title = st.text_input("Enter Chart Title", "Histogram")
49
+ plt.hist(data[selected_column], bins=bins)
50
+ plt.title(title)
51
+ plt.xlabel(selected_column)
52
+ plt.ylabel('Frequency')
53
+ st.pyplot()