Niharmahesh commited on
Commit
b5907fd
·
verified ·
1 Parent(s): 05f5a05

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -6
app.py CHANGED
@@ -7,7 +7,7 @@ from datetime import datetime, timedelta
7
  import time
8
  import pyarrow as pa
9
  import pyarrow.parquet as pq
10
-
11
  # Set page config for a wider layout and custom theme
12
  st.set_page_config(layout="wide", page_title="Job Listings Dashboard")
13
 
@@ -173,7 +173,7 @@ def display_data_explorer(df):
173
 
174
  if show_all == "Filtered Data":
175
  unique_values = get_unique_values(df)
176
- col1, col2, col3,col4 = st.columns(4)
177
  with col1:
178
  companies = st.multiselect("Select Companies", options=unique_values['companies'])
179
  with col2:
@@ -183,19 +183,36 @@ def display_data_explorer(df):
183
  with col4:
184
  Role_type = st.multiselect("Select Role Types", options=unique_values['Role_Name'])
185
 
186
- filtered_df = filter_dataframe(df, companies, locations, job_types,Role_type)
187
  else:
188
  filtered_df = df
189
 
190
  st.write(f"Showing {len(filtered_df)} job listings")
191
 
 
 
 
 
 
 
 
 
 
 
 
 
 
192
  def make_clickable(url):
193
  return f'<a href="{url}" target="_blank" style="color: #4e79a7;">Link</a>'
194
 
195
- filtered_df['job_url'] = filtered_df['job_url'].apply(make_clickable)
196
- filtered_df['company_url'] = filtered_df['company_url'].apply(make_clickable)
197
 
198
- st.write(filtered_df.to_html(escape=False, index=False), unsafe_allow_html=True)
 
 
 
 
199
  def display_about_page():
200
  st.markdown("""
201
  ## What is this application?
 
7
  import time
8
  import pyarrow as pa
9
  import pyarrow.parquet as pq
10
+ import math
11
  # Set page config for a wider layout and custom theme
12
  st.set_page_config(layout="wide", page_title="Job Listings Dashboard")
13
 
 
173
 
174
  if show_all == "Filtered Data":
175
  unique_values = get_unique_values(df)
176
+ col1, col2, col3, col4 = st.columns(4)
177
  with col1:
178
  companies = st.multiselect("Select Companies", options=unique_values['companies'])
179
  with col2:
 
183
  with col4:
184
  Role_type = st.multiselect("Select Role Types", options=unique_values['Role_Name'])
185
 
186
+ filtered_df = filter_dataframe(df, companies, locations, job_types, Role_type)
187
  else:
188
  filtered_df = df
189
 
190
  st.write(f"Showing {len(filtered_df)} job listings")
191
 
192
+ # Pagination
193
+ items_per_page = 15
194
+ num_pages = math.ceil(len(filtered_df) / items_per_page)
195
+
196
+ col1, col2, col3 = st.columns([1, 3, 1])
197
+ with col2:
198
+ page = st.number_input("Page", min_value=1, max_value=num_pages, value=1)
199
+
200
+ start_idx = (page - 1) * items_per_page
201
+ end_idx = start_idx + items_per_page
202
+
203
+ page_df = filtered_df.iloc[start_idx:end_idx]
204
+
205
  def make_clickable(url):
206
  return f'<a href="{url}" target="_blank" style="color: #4e79a7;">Link</a>'
207
 
208
+ page_df['job_url'] = page_df['job_url'].apply(make_clickable)
209
+ page_df['company_url'] = page_df['company_url'].apply(make_clickable)
210
 
211
+ st.write(page_df.to_html(escape=False, index=False), unsafe_allow_html=True)
212
+
213
+ col1, col2, col3 = st.columns([1, 3, 1])
214
+ with col2:
215
+ st.write(f"Page {page} of {num_pages}")
216
  def display_about_page():
217
  st.markdown("""
218
  ## What is this application?