Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the streamlit app #276

Merged
merged 3 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions streamlit/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
from scipy.stats import norm
import re

data = pd.read_csv('df2020.csv')
df2018 = pd.read_csv('df2018.csv')
full_data2018 = pd.read_csv('survey_results_sample_2018.csv')
full_data2019=pd.read_csv('survey_results_sample_2019.csv')
full_df2020 = pd.read_csv('survey_results_sample_2020.csv')
df2019 = pd.read_csv('df2019.csv')
data = pd.read_csv('streamlit/df2020.csv')
df2018 = pd.read_csv('streamlit/df2018.csv')
full_data2018 = pd.read_csv('streamlit/survey_results_sample_2018.csv')
full_data2019=pd.read_csv('streamlit/survey_results_sample_2019.csv')
full_df2020 = pd.read_csv('streamlit/survey_results_sample_2020.csv')
df2019 = pd.read_csv('streamlit/df2019.csv')
df2020 = data[(data['SalaryUSD'] < 200000)]

# features for job satisfaction
results = pd.read_csv("results.csv")
results = pd.read_csv("streamlit/results.csv")


#######################################
Expand Down
25 changes: 11 additions & 14 deletions streamlit/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,31 @@
import random
import functions as ff
import main_analysis as main
import os


#######################################
# DATA LOADING
#######################################

st.set_page_config(layout='wide')

# Determine the base path
base_path = os.path.dirname(__file__)

# Loading data files
df = pd.read_csv(os.path.join(base_path, 'df2020.csv'))
df2018 = pd.read_csv(os.path.join(base_path, 'df2018.csv'))
full_data2018 = pd.read_csv(os.path.join(base_path, 'survey_results_sample_2018.csv'))
full_data2019 = pd.read_csv(os.path.join(base_path, 'survey_results_sample_2019.csv'))
full_df2020 = pd.read_csv(os.path.join(base_path, 'survey_results_sample_2020.csv'))
df2019 = pd.read_csv(os.path.join(base_path, 'df2019.csv'))
# Loading data files from the 'streamlit' directory
df = pd.read_csv('streamlit/df2020.csv')
df2018 = pd.read_csv('streamlit/df2018.csv')
full_data2018 = pd.read_csv('streamlit/survey_results_sample_2018.csv')
full_data2019 = pd.read_csv('streamlit/survey_results_sample_2019.csv')
full_df2020 = pd.read_csv('streamlit/survey_results_sample_2020.csv')
df2019 = pd.read_csv('streamlit/df2019.csv')

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

# Load CSS file
def local_css(file_name):
css_path = os.path.join(base_path, file_name)
with open(css_path) as f:
with open(file_name) as f:
st.markdown(f'<style>{f.read()}</style>', unsafe_allow_html=True)

local_css("style.css")
local_css("streamlit/style.css")

#######################################
# DATA PREPARATION FOR VISUALISATION
Expand Down Expand Up @@ -203,3 +199,4 @@ def plot_value_counts(column_name):
</div>
"""
st.markdown(highest_paying_ds_text, unsafe_allow_html=True)

14 changes: 7 additions & 7 deletions streamlit/main_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
import plotly.express as px
import functions as ff

data = pd.read_csv('df2020.csv')
df2018 = pd.read_csv('df2018.csv')
full_data2018 = pd.read_csv('survey_results_sample_2018.csv')
full_data2019=pd.read_csv('survey_results_sample_2019.csv')
full_df2020 = pd.read_csv('survey_results_sample_2020.csv')
df2019 = pd.read_csv('df2019.csv')
data = pd.read_csv('streamlit/df2020.csv')
df2018 = pd.read_csv('streamlit/df2018.csv')
full_data2018 = pd.read_csv('streamlit/survey_results_sample_2018.csv')
full_data2019=pd.read_csv('streamlit/survey_results_sample_2019.csv')
full_df2020 = pd.read_csv('streamlit/survey_results_sample_2020.csv')
df2019 = pd.read_csv('streamlit/df2019.csv')
df2020 = data[(data['SalaryUSD'] < 200000)]

# features for job satisfaction
results = pd.read_csv("results.csv")
results = pd.read_csv("streamlit/results.csv")

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