mihaeladuta commited on
Commit
a79589f
·
1 Parent(s): 85d56af

Tweaked research groups page.

Browse files
Files changed (2) hide show
  1. src/pages/1_Research_Groups.py +12 -12
  2. src/read_write.py +1 -0
src/pages/1_Research_Groups.py CHANGED
@@ -17,7 +17,7 @@ with st.spinner(rw.PROC_TEXT):
17
 
18
  dset_to_print = pd.DataFrame.from_dict(
19
  {
20
- "Research groups records": dset.shape[0],
21
  "Institutions": dset[cb.COL_INST_CODE].nunique()
22
  },
23
  orient="index"
@@ -26,12 +26,13 @@ dset_to_print.columns = ["count"]
26
  pd.set_option("display.max_colwidth", None)
27
  st.dataframe(dset_to_print)
28
 
 
29
 
30
  st.markdown("Select from the charts below to view the "
31
  "distributions for the number of research groups records by ...")
32
 
33
  columns = [cb.COL_PANEL_NAME,
34
- cb.COL_UOA_NAME]
35
  tab_names = columns.copy()
36
  tab_names.append(f"{cb.COL_PANEL_NAME} & {cb.COL_UOA_NAME}")
37
  tabs = st.tabs(tab_names)
@@ -40,21 +41,20 @@ for i, column in enumerate(columns):
40
 
41
  with tabs[i]:
42
  dset_stats = proc.calculate_counts(dset,
43
- column,
44
- sort=False)
45
  vis.draw_counts_percent_chart(dset_stats,
46
- column)
47
  with tabs[2]:
48
  dset_stats = proc.calculate_grouped_counts(dset,
49
- [cb.COL_PANEL_NAME, cb.COL_UOA_NAME]
50
- )
51
  vis.draw_grouped_counts_chart(dset_stats,
52
- cb.COL_PANEL_NAME,
53
- cb.COL_UOA_NAME,
54
- cb.COL_PANEL_NAME
55
- )
56
 
 
57
 
58
  dset_explore = dataframe_explorer(dset)
59
  st.dataframe(dset_explore, use_container_width=False)
60
-
 
17
 
18
  dset_to_print = pd.DataFrame.from_dict(
19
  {
20
+ "Records": dset.shape[0],
21
  "Institutions": dset[cb.COL_INST_CODE].nunique()
22
  },
23
  orient="index"
 
26
  pd.set_option("display.max_colwidth", None)
27
  st.dataframe(dset_to_print)
28
 
29
+ st.subheader("Charts")
30
 
31
  st.markdown("Select from the charts below to view the "
32
  "distributions for the number of research groups records by ...")
33
 
34
  columns = [cb.COL_PANEL_NAME,
35
+ cb.COL_UOA_NAME]
36
  tab_names = columns.copy()
37
  tab_names.append(f"{cb.COL_PANEL_NAME} & {cb.COL_UOA_NAME}")
38
  tabs = st.tabs(tab_names)
 
41
 
42
  with tabs[i]:
43
  dset_stats = proc.calculate_counts(dset,
44
+ column,
45
+ sort=False)
46
  vis.draw_counts_percent_chart(dset_stats,
47
+ column)
48
  with tabs[2]:
49
  dset_stats = proc.calculate_grouped_counts(dset,
50
+ [cb.COL_PANEL_NAME, cb.COL_UOA_NAME])
 
51
  vis.draw_grouped_counts_chart(dset_stats,
52
+ cb.COL_PANEL_NAME,
53
+ cb.COL_UOA_NAME,
54
+ cb.COL_PANEL_NAME
55
+ )
56
 
57
+ st.subheader("Explore the data")
58
 
59
  dset_explore = dataframe_explorer(dset)
60
  st.dataframe(dset_explore, use_container_width=False)
 
src/read_write.py CHANGED
@@ -22,6 +22,7 @@ DATA_PPROC_RESULTS = f"{DATA_PATH}Results{DATA_PPROCESS}{DATA_EXT}"
22
 
23
  PROC_TEXT = "Processing request..."
24
 
 
25
  @st.cache_data
26
  def get_data(fname, categories_columns=[]):
27
  """ Read a csv file and return a dataset and a list of institution names.
 
22
 
23
  PROC_TEXT = "Processing request..."
24
 
25
+
26
  @st.cache_data
27
  def get_data(fname, categories_columns=[]):
28
  """ Read a csv file and return a dataset and a list of institution names.