georad commited on
Commit
2f6133f
·
verified ·
1 Parent(s): 8b893c4

Update pages/chapter_index.py

Browse files
Files changed (1) hide show
  1. pages/chapter_index.py +5 -5
pages/chapter_index.py CHANGED
@@ -5,13 +5,13 @@ import pandas as pd
5
  #st.title("📘SBS mapper")
6
  #st.write("Map internal descriptions to SBS codes in the below chapters* (work in progress)")
7
  #st.image("images/SBS_Chapter_Index.png", use_container_width=True)
8
- st.header("Select specific topic for quicker results")
9
  df_chapters = pd.read_csv("SBS_V2_Chapter_Index.csv")
10
- df_chapters.iloc[25] = {"Chapter": "ALL", "Chapter title": "ALL TOPICS (will take more time)", "Blocks": "Total", "No. Codes": 10081}
11
  st.dataframe(df_chapters, hide_index=True)
12
 
13
- def dataframe_with_selections(df: pd.DataFrame, init_value: bool = False) -> pd.DataFrame:
14
- df_with_selections = df.copy()
15
  df_with_selections.insert(0, "Select", init_value)
16
 
17
  # Get dataframe row-selections from user with st.data_editor
@@ -26,7 +26,7 @@ def dataframe_with_selections(df: pd.DataFrame, init_value: bool = False) -> pd.
26
  selected_rows = edited_df[edited_df.Select]
27
  return selected_rows.drop('Select', axis=1)
28
 
29
- selection = dataframe_with_selections(df)
30
  st.write("Your selection:")
31
  st.write(selection)
32
 
 
5
  #st.title("📘SBS mapper")
6
  #st.write("Map internal descriptions to SBS codes in the below chapters* (work in progress)")
7
  #st.image("images/SBS_Chapter_Index.png", use_container_width=True)
8
+ st.header("Select specific Chapter for quicker results")
9
  df_chapters = pd.read_csv("SBS_V2_Chapter_Index.csv")
10
+ df_chapters.iloc[25] = {"Chapter": "ALL", "Chapter title": "ALL CHAPTERS (will take more time)", "Blocks": "Total", "No. Codes": 10081}
11
  st.dataframe(df_chapters, hide_index=True)
12
 
13
+ def dataframe_with_selections(df_chapters: pd.DataFrame, init_value: bool = False) -> pd.DataFrame:
14
+ df_with_selections = df_chapters.copy()
15
  df_with_selections.insert(0, "Select", init_value)
16
 
17
  # Get dataframe row-selections from user with st.data_editor
 
26
  selected_rows = edited_df[edited_df.Select]
27
  return selected_rows.drop('Select', axis=1)
28
 
29
+ selection = dataframe_with_selections(df_chapters)
30
  st.write("Your selection:")
31
  st.write(selection)
32