8
8
from scipy .stats import norm
9
9
from scipy import stats
10
10
import random
11
- import functions as ff
11
+ import functions as func
12
12
import main_analysis as main
13
13
14
-
15
14
#######################################
16
15
# DATA LOADING
17
16
#######################################
18
17
19
18
st .set_page_config (layout = 'wide' )
20
19
21
20
# 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' )
28
27
29
28
# Filter the 2020 dataframe
30
29
df2020 = df [df ['SalaryUSD' ] < 200000 ]
31
30
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
+ """
36
63
37
- local_css ( "streamlit/style. css" )
64
+ st . markdown ( css , unsafe_allow_html = True )
38
65
39
66
#######################################
40
67
# DATA PREPARATION FOR VISUALISATION
@@ -98,7 +125,7 @@ def plot_value_counts(column_name):
98
125
visual , analysis = st .columns ((3 , 1 ))
99
126
with visual :
100
127
st .title ("Highest Paying Countries for Data Scientists" )
101
- ff .heighest_paying (full_data2018 )
128
+ func .heighest_paying (full_data2018 )
102
129
with analysis :
103
130
highest_paying_ds_text = """
104
131
<div class='analysis-container'>
@@ -112,7 +139,7 @@ def plot_value_counts(column_name):
112
139
113
140
with visual :
114
141
st .title ("Operating System" )
115
- ff .plot_pie_plotly (full_data2018 , 'OpSys' )
142
+ func .plot_pie_plotly (full_data2018 , 'OpSys' )
116
143
with analysis :
117
144
operating_text = """
118
145
<div class='analysis-container'>
@@ -126,8 +153,8 @@ def plot_value_counts(column_name):
126
153
127
154
with visual :
128
155
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 )
131
158
with analysis :
132
159
top_ide_text = """
133
160
<div class='analysis-container'>
@@ -143,7 +170,7 @@ def plot_value_counts(column_name):
143
170
"""
144
171
st .markdown (top_ide_text , unsafe_allow_html = True )
145
172
146
- ff .ai_graphs ()
173
+ func .ai_graphs ()
147
174
148
175
ai_text = """
149
176
<div class='analysis-container-extra'>
@@ -170,7 +197,7 @@ def plot_value_counts(column_name):
170
197
visual , analysis = st .columns ((3 , 1 ))
171
198
with visual :
172
199
st .title ("Highest Paying Countries for Data Scientists" )
173
- ff .heighest_paying_2019 ()
200
+ func .heighest_paying_2019 ()
174
201
with analysis :
175
202
highest_paying_ds_text = """
176
203
<div class='analysis-container'>
@@ -188,7 +215,7 @@ def plot_value_counts(column_name):
188
215
visual , analysis = st .columns ((3 , 1 ))
189
216
with visual :
190
217
st .title ("Highest Paying Countries for Data Scientists" )
191
- ff .heighest_paying (df2020 )
218
+ func .heighest_paying (df2020 )
192
219
with analysis :
193
220
highest_paying_ds_text = """
194
221
<div class='analysis-container'>
@@ -199,4 +226,3 @@ def plot_value_counts(column_name):
199
226
</div>
200
227
"""
201
228
st .markdown (highest_paying_ds_text , unsafe_allow_html = True )
202
-
0 commit comments