File size: 3,554 Bytes
210df59
6e44ce9
9576521
210df59
 
 
 
9576521
4aefa71
 
 
9576521
210df59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9576521
210df59
 
 
 
 
 
 
 
9576521
210df59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9576521
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101

import streamlit as st
import pandas as pd
import matplotlib.pyplot as plt
from streamlit.components.v1 import html
import nbformat
from nbconvert import HTMLExporter

# Load the CSV data
file_path = 'category upwork jobs.csv'
jobs_df = pd.read_csv(file_path)

# Adjust column names as per the CSV
category_column = 'category'  # Replace with the actual column name for category
job_title_column = 'title'  # Replace with the actual column name for job title
description_column = 'Description'
key_column = 'key'
date_column = 'Date'

# Sidebar menu
st.sidebar.title("Navigation")
option = st.sidebar.radio("Go to", ["Home", "Plots", "Notebook","Download Datasets"])
# Home Page: Display data with category filter
if option == "Home":
    st.title("Jobs Dashboard")

    # Filter Jobs by Category
    st.sidebar.header("Filter Jobs by Category")
    categories = jobs_df[category_column].unique()  # Extract unique categories
    selected_category = st.sidebar.selectbox("Choose a category:", categories)

    # Filter jobs based on the selected category
    filtered_jobs = jobs_df[jobs_df[category_column] == selected_category]

    # Display filtered jobs with additional columns
    st.write(f"Showing jobs in category: **{selected_category}**")
    st.dataframe(filtered_jobs[['title','key','description','date']])

    # Optional: Show a count of jobs in the selected category
    st.write(f"Total jobs in this category: {len(filtered_jobs)}")

# Plots Page: Display category distribution plot
elif option == "Plots":
    st.title("Job Category Distribution")
    
    # Count occurrences of each category
    category_counts = jobs_df[category_column].value_counts()

    # Create a bar plot using matplotlib
    fig, ax = plt.subplots(figsize=(12, 6))
    ax.bar(category_counts.index, category_counts.values)
    ax.set_xlabel("Job Category")
    ax.set_ylabel("Number of Jobs")
    ax.set_title("Distribution of Jobs Across Categories")
    plt.xticks(rotation=45, ha="right")
    plt.tight_layout()

    # Display the plot in Streamlit
    st.pyplot(fig)
# Notebook Page: Render the Jupyter Notebook
elif option == "Notebook":
    st.title("Jupyter Notebook")

    # Load and convert the notebook to HTML
    notebook_path = 'upwork_dashboard.ipynb'  # Update with the actual path to your notebook
    with open(notebook_path) as f:
        notebook_content = nbformat.read(f, as_version=4)
    
    html_exporter = HTMLExporter()
    html_exporter.exclude_input = False  # Include code cells in the notebook display
    notebook_html, _ = html_exporter.from_notebook_node(notebook_content)

    # Display the notebook HTML in Streamlit
    html(notebook_html, height=800, scrolling=True)
elif option == "Download Datasets":
    st.title("Download Datasets")
    d=pd.read_csv("category upwork jobs.csv")
    d1=pd.read_csv("jobs.csv")
    # Download links for the datasets
    st.markdown("Click the links below to download the datasets:")
    
    # Link for category upwork jobs dataset
    with open("category upwork jobs.csv", 'rb') as f:
        st.download_button(
            label="Download Category Upwork Jobs Dataset",
            data=f,
            file_name='category_upwork_jobs.csv',
            mime='text/csv'
        )
    st.dataframe(d)
    # Link for the original dataset
    with open("jobs.csv", 'rb') as f:
        st.download_button(
            label="Download Original Dataset",
            data=f,
            file_name='origina scraped data.csv',
            mime='text/csv'
        )
        st.dataframe(d1)