Spaces:
Sleeping
Sleeping
redfernstech
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,7 @@ import matplotlib.pyplot as plt
|
|
5 |
from streamlit.components.v1 import html
|
6 |
import nbformat
|
7 |
from nbconvert import HTMLExporter
|
|
|
8 |
|
9 |
# Load the CSV data
|
10 |
file_path = 'category upwork jobs.csv'
|
@@ -41,22 +42,47 @@ if option == "Home":
|
|
41 |
|
42 |
# Plots Page: Display category distribution plot
|
43 |
elif option == "Plots":
|
44 |
-
st.title("Job
|
45 |
-
|
46 |
-
#
|
|
|
47 |
category_counts = jobs_df[category_column].value_counts()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
|
|
|
|
|
|
|
|
55 |
plt.xticks(rotation=45, ha="right")
|
56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
|
58 |
-
# Display the plot in Streamlit
|
59 |
-
st.pyplot(fig)
|
60 |
elif option == "Notebook":
|
61 |
st.title("Jupyter Notebook")
|
62 |
|
|
|
5 |
from streamlit.components.v1 import html
|
6 |
import nbformat
|
7 |
from nbconvert import HTMLExporter
|
8 |
+
from wordcloud import WordCloud
|
9 |
|
10 |
# Load the CSV data
|
11 |
file_path = 'category upwork jobs.csv'
|
|
|
42 |
|
43 |
# Plots Page: Display category distribution plot
|
44 |
elif option == "Plots":
|
45 |
+
st.title("Job Visualization")
|
46 |
+
|
47 |
+
# 1. Job Category Distribution Bar Plot
|
48 |
+
st.subheader("Job Category Distribution")
|
49 |
category_counts = jobs_df[category_column].value_counts()
|
50 |
+
fig1, ax1 = plt.subplots()
|
51 |
+
ax1.bar(category_counts.index, category_counts.values)
|
52 |
+
ax1.set_xlabel("Job Category")
|
53 |
+
ax1.set_ylabel("Number of Jobs")
|
54 |
+
ax1.set_title("Distribution of Jobs Across Categories")
|
55 |
+
plt.xticks(rotation=45, ha="right")
|
56 |
+
st.pyplot(fig1)
|
57 |
+
|
58 |
+
# 2. Pie Chart for Category Distribution
|
59 |
+
st.subheader("Job Category Proportions")
|
60 |
+
fig2, ax2 = plt.subplots(figsize=(10, 25))
|
61 |
+
ax2.pie(category_counts, labels=category_counts.index, autopct='%1.1f%%', startangle=140)
|
62 |
+
ax2.axis('equal') # Equal aspect ratio ensures the pie chart is circular.
|
63 |
+
st.pyplot(fig2)
|
64 |
|
65 |
+
|
66 |
+
|
67 |
+
# 4. Top Job Titles Bar Plot
|
68 |
+
st.subheader("Top Job Titles")
|
69 |
+
top_job_titles = jobs_df[job_title_column].value_counts().head(10)
|
70 |
+
fig4, ax4 = plt.subplots()
|
71 |
+
ax4.bar(top_job_titles.index, top_job_titles.values)
|
72 |
+
ax4.set_xlabel("Job Title")
|
73 |
+
ax4.set_ylabel("Count")
|
74 |
+
ax4.set_title("Top 10 Job Titles")
|
75 |
plt.xticks(rotation=45, ha="right")
|
76 |
+
st.pyplot(fig4)
|
77 |
+
|
78 |
+
# 5. Word Cloud for Job Descriptions
|
79 |
+
st.subheader("Word Cloud for Job Descriptions")
|
80 |
+
wordcloud = WordCloud(width=800, height=400, background_color='white').generate(' '.join(jobs_df[description_column].dropna()))
|
81 |
+
fig5, ax5 = plt.subplots(figsize=(10, 5))
|
82 |
+
ax5.imshow(wordcloud, interpolation='bilinear')
|
83 |
+
ax5.axis('off') # Turn off the axis
|
84 |
+
st.pyplot(fig5)
|
85 |
|
|
|
|
|
86 |
elif option == "Notebook":
|
87 |
st.title("Jupyter Notebook")
|
88 |
|