Jan Mühlnikel
commited on
Commit
·
de39c9b
1
Parent(s):
3f956ac
added selected project df
Browse files
modules/singlematch_result_table.py
CHANGED
@@ -4,24 +4,23 @@ import pandas as pd
|
|
4 |
def show_single_table(selected_project_index, projects_df, result_df):
|
5 |
|
6 |
st.write("------------------")
|
7 |
-
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
sel_p_row["sdg_list"] = [sel_p_row['sgd_pred_code'].item()]
|
20 |
|
21 |
st.dataframe(
|
22 |
-
|
23 |
use_container_width = True,
|
24 |
-
height = 35 + 35 * len(
|
25 |
column_config={
|
26 |
"iati_id": st.column_config.TextColumn(
|
27 |
"IATI ID",
|
|
|
4 |
def show_single_table(selected_project_index, projects_df, result_df):
|
5 |
|
6 |
st.write("------------------")
|
7 |
+
project_series = projects_df.iloc[selected_project_index]
|
8 |
|
9 |
+
# Transform data as needed (example with dummy data for 'crs_3_code' and 'crs_5_code')
|
10 |
+
project_series['crs_3_code_list'] = project_series.get('crs_3_code', '').split(";")[:-1] or [""]
|
11 |
+
project_series['crs_5_code_list'] = project_series.get('crs_5_code', '').split(";")[:-1] or [""]
|
12 |
+
project_series['sdg_list'] = [project_series.get('sgd_pred_code', '')]
|
13 |
|
14 |
+
# Create a new DataFrame for the transformed Series for a vertical display
|
15 |
+
display_df = pd.DataFrame({
|
16 |
+
'Field': project_series.index,
|
17 |
+
'Value': project_series.values
|
18 |
+
})
|
|
|
19 |
|
20 |
st.dataframe(
|
21 |
+
display_df[["iati_id", "title_main", "orga_abbreviation", "client", "description_main", "country_name", "country_flag", "sdg_list", "crs_3_code_list", "crs_5_code_list"]],
|
22 |
use_container_width = True,
|
23 |
+
height = 35 + 35 * len(display_df),
|
24 |
column_config={
|
25 |
"iati_id": st.column_config.TextColumn(
|
26 |
"IATI ID",
|