Skip to content

Commit c22ff85

Browse files
authored
Merge pull request #277 from revanth1718/main
Fixed streamlit app
2 parents 3f9067c + e87352c commit c22ff85

File tree

6 files changed

+61
-65
lines changed

6 files changed

+61
-65
lines changed
619 Bytes
Binary file not shown.
619 Bytes
Binary file not shown.

streamlit/functions.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99
from scipy.stats import norm
1010
import re
1111

12-
data = pd.read_csv('streamlit/df2020.csv')
13-
df2018 = pd.read_csv('streamlit/df2018.csv')
14-
full_data2018 = pd.read_csv('streamlit/survey_results_sample_2018.csv')
15-
full_data2019=pd.read_csv('streamlit/survey_results_sample_2019.csv')
16-
full_df2020 = pd.read_csv('streamlit/survey_results_sample_2020.csv')
17-
df2019 = pd.read_csv('streamlit/df2019.csv')
12+
data = pd.read_csv('https://raw.githubusercontent.com/Recode-Hive/Stackoverflow-Analysis/main/streamlit/df2020.csv')
13+
df2018 = pd.read_csv('https://raw.githubusercontent.com/Recode-Hive/Stackoverflow-Analysis/main/streamlit/df2018.csv')
14+
full_data2018 = pd.read_csv('https://raw.githubusercontent.com/Recode-Hive/Stackoverflow-Analysis/main/streamlit/survey_results_sample_2018.csv')
15+
full_data2019=pd.read_csv('https://raw.githubusercontent.com/Recode-Hive/Stackoverflow-Analysis/main/streamlit/survey_results_sample_2019.csv')
16+
full_df2020 = pd.read_csv('https://raw.githubusercontent.com/Recode-Hive/Stackoverflow-Analysis/main/streamlit/survey_results_sample_2020.csv')
17+
df2019 = pd.read_csv('https://raw.githubusercontent.com/Recode-Hive/Stackoverflow-Analysis/main/streamlit/df2019.csv')
1818
df2020 = data[(data['SalaryUSD'] < 200000)]
1919

2020
# features for job satisfaction
21-
results = pd.read_csv("streamlit/results.csv")
21+
results = pd.read_csv("https://raw.githubusercontent.com/Recode-Hive/Stackoverflow-Analysis/main/streamlit/results.csv")
2222

2323

2424
#######################################

streamlit/home.py

Lines changed: 47 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,60 @@
88
from scipy.stats import norm
99
from scipy import stats
1010
import random
11-
import functions as ff
11+
import functions as func
1212
import main_analysis as main
1313

14-
1514
#######################################
1615
# DATA LOADING
1716
#######################################
1817

1918
st.set_page_config(layout='wide')
2019

2120
# Loading data files from the 'streamlit' directory
22-
df = pd.read_csv('streamlit/df2020.csv')
23-
df2018 = pd.read_csv('streamlit/df2018.csv')
24-
full_data2018 = pd.read_csv('streamlit/survey_results_sample_2018.csv')
25-
full_data2019 = pd.read_csv('streamlit/survey_results_sample_2019.csv')
26-
full_df2020 = pd.read_csv('streamlit/survey_results_sample_2020.csv')
27-
df2019 = pd.read_csv('streamlit/df2019.csv')
21+
df = pd.read_csv('https://raw.githubusercontent.com/Recode-Hive/Stackoverflow-Analysis/main/streamlit/df2020.csv')
22+
df2018 = pd.read_csv('https://raw.githubusercontent.com/Recode-Hive/Stackoverflow-Analysis/main/streamlit/df2018.csv')
23+
full_data2018 = pd.read_csv('https://raw.githubusercontent.com/Recode-Hive/Stackoverflow-Analysis/main/streamlit/survey_results_sample_2018.csv')
24+
full_data2019 = pd.read_csv('https://raw.githubusercontent.com/Recode-Hive/Stackoverflow-Analysis/main/streamlit/survey_results_sample_2019.csv')
25+
full_df2020 = pd.read_csv('https://raw.githubusercontent.com/Recode-Hive/Stackoverflow-Analysis/main/streamlit/survey_results_sample_2020.csv')
26+
df2019 = pd.read_csv('https://raw.githubusercontent.com/Recode-Hive/Stackoverflow-Analysis/main/streamlit/df2019.csv')
2827

2928
# Filter the 2020 dataframe
3029
df2020 = df[df['SalaryUSD'] < 200000]
3130

32-
# Load CSS file
33-
def local_css(file_name):
34-
with open(file_name) as f:
35-
st.markdown(f'<style>{f.read()}</style>', unsafe_allow_html=True)
31+
#######################################
32+
# CSS STYLING
33+
#######################################
34+
35+
css = """
36+
<style>
37+
.analysis-container {
38+
font-family: 'Courier New', Courier, monospace;
39+
background-color: #D8DEDF;
40+
padding: 15px;
41+
border-radius: 10px;
42+
margin-top: 150px;
43+
margin-bottom: 110px;
44+
}
45+
46+
.analysis-container-extra {
47+
font-family: 'Courier New', Courier, monospace;
48+
background-color: #D8DEDF;
49+
padding: 15px;
50+
border-radius: 10px;
51+
margin-top: 50px;
52+
margin-bottom: 20px;
53+
}
54+
55+
.analysis-title {
56+
font-size: 18px;
57+
font-weight: bold;
58+
color: #333333;
59+
margin-bottom: 10px;
60+
}
61+
</style>
62+
"""
3663

37-
local_css("streamlit/style.css")
64+
st.markdown(css, unsafe_allow_html=True)
3865

3966
#######################################
4067
# DATA PREPARATION FOR VISUALISATION
@@ -98,7 +125,7 @@ def plot_value_counts(column_name):
98125
visual, analysis = st.columns((3, 1))
99126
with visual:
100127
st.title("Highest Paying Countries for Data Scientists")
101-
ff.heighest_paying(full_data2018)
128+
func.heighest_paying(full_data2018)
102129
with analysis:
103130
highest_paying_ds_text = """
104131
<div class='analysis-container'>
@@ -112,7 +139,7 @@ def plot_value_counts(column_name):
112139

113140
with visual:
114141
st.title("Operating System")
115-
ff.plot_pie_plotly(full_data2018, 'OpSys')
142+
func.plot_pie_plotly(full_data2018, 'OpSys')
116143
with analysis:
117144
operating_text = """
118145
<div class='analysis-container'>
@@ -126,8 +153,8 @@ def plot_value_counts(column_name):
126153

127154
with visual:
128155
st.title("Top IDEs")
129-
ff.plot_bar_plotly(full_data2018, "IDE", 10, 500, 800)
130-
ff.plot_pie_plotly(full_data2018, "IDE", 10, 550, 600)
156+
func.plot_bar_plotly(full_data2018, "IDE", 10, 500, 800)
157+
func.plot_pie_plotly(full_data2018, "IDE", 10, 550, 600)
131158
with analysis:
132159
top_ide_text = """
133160
<div class='analysis-container'>
@@ -143,7 +170,7 @@ def plot_value_counts(column_name):
143170
"""
144171
st.markdown(top_ide_text, unsafe_allow_html=True)
145172

146-
ff.ai_graphs()
173+
func.ai_graphs()
147174

148175
ai_text = """
149176
<div class='analysis-container-extra'>
@@ -170,7 +197,7 @@ def plot_value_counts(column_name):
170197
visual, analysis = st.columns((3, 1))
171198
with visual:
172199
st.title("Highest Paying Countries for Data Scientists")
173-
ff.heighest_paying_2019()
200+
func.heighest_paying_2019()
174201
with analysis:
175202
highest_paying_ds_text = """
176203
<div class='analysis-container'>
@@ -188,7 +215,7 @@ def plot_value_counts(column_name):
188215
visual, analysis = st.columns((3, 1))
189216
with visual:
190217
st.title("Highest Paying Countries for Data Scientists")
191-
ff.heighest_paying(df2020)
218+
func.heighest_paying(df2020)
192219
with analysis:
193220
highest_paying_ds_text = """
194221
<div class='analysis-container'>
@@ -199,4 +226,3 @@ def plot_value_counts(column_name):
199226
</div>
200227
"""
201228
st.markdown(highest_paying_ds_text, unsafe_allow_html=True)
202-

streamlit/main_analysis.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
import plotly.express as px
44
import functions as ff
55

6-
data = pd.read_csv('streamlit/df2020.csv')
7-
df2018 = pd.read_csv('streamlit/df2018.csv')
8-
full_data2018 = pd.read_csv('streamlit/survey_results_sample_2018.csv')
9-
full_data2019=pd.read_csv('streamlit/survey_results_sample_2019.csv')
10-
full_df2020 = pd.read_csv('streamlit/survey_results_sample_2020.csv')
11-
df2019 = pd.read_csv('streamlit/df2019.csv')
6+
data = pd.read_csv('https://raw.githubusercontent.com/Recode-Hive/Stackoverflow-Analysis/main/streamlit/df2020.csv')
7+
df2018 = pd.read_csv('https://raw.githubusercontent.com/Recode-Hive/Stackoverflow-Analysis/main/streamlit/df2018.csv')
8+
full_data2018 = pd.read_csv('https://raw.githubusercontent.com/Recode-Hive/Stackoverflow-Analysis/main/streamlit/survey_results_sample_2018.csv')
9+
full_data2019=pd.read_csv('https://raw.githubusercontent.com/Recode-Hive/Stackoverflow-Analysis/main/streamlit/survey_results_sample_2019.csv')
10+
full_df2020 = pd.read_csv('https://raw.githubusercontent.com/Recode-Hive/Stackoverflow-Analysis/main/streamlit/survey_results_sample_2020.csv')
11+
df2019 = pd.read_csv('https://raw.githubusercontent.com/Recode-Hive/Stackoverflow-Analysis/main/streamlit/df2019.csv')
1212
df2020 = data[(data['SalaryUSD'] < 200000)]
1313

1414
# features for job satisfaction
15-
results = pd.read_csv("streamlit/results.csv")
15+
results = pd.read_csv("https://raw.githubusercontent.com/Recode-Hive/Stackoverflow-Analysis/main/streamlit/results.csv")
1616

1717
# for hightest paying ds
1818
full_data2018.rename(columns={'ConvertedSalary': 'SalaryUSD'}, inplace=True)

streamlit/style.css

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)