Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Jan Mühlnikel
commited on
Commit
·
7823114
1
Parent(s):
46060b0
chnaged result table and fixed an issue withe a copy in the country filtering
Browse files
functions/__pycache__/calc_matches.cpython-310.pyc
CHANGED
|
Binary files a/functions/__pycache__/calc_matches.cpython-310.pyc and b/functions/__pycache__/calc_matches.cpython-310.pyc differ
|
|
|
functions/__pycache__/filter_projects.cpython-310.pyc
CHANGED
|
Binary files a/functions/__pycache__/filter_projects.cpython-310.pyc and b/functions/__pycache__/filter_projects.cpython-310.pyc differ
|
|
|
functions/filter_projects.py
CHANGED
|
@@ -26,7 +26,7 @@ def filter_projects(df, crs3_list, crs5_list, sdg_str, country_code_list, orga_c
|
|
| 26 |
country_filtered_df = pd.DataFrame()
|
| 27 |
for c in country_code_list:
|
| 28 |
c_df = df[df["country"].str.contains(c, na=False)]
|
| 29 |
-
country_filtered_df = pd.concat([country_filtered_df, c_df], ignore_index=
|
| 30 |
|
| 31 |
df = country_filtered_df
|
| 32 |
|
|
|
|
| 26 |
country_filtered_df = pd.DataFrame()
|
| 27 |
for c in country_code_list:
|
| 28 |
c_df = df[df["country"].str.contains(c, na=False)]
|
| 29 |
+
country_filtered_df = pd.concat([country_filtered_df, c_df], ignore_index=False)
|
| 30 |
|
| 31 |
df = country_filtered_df
|
| 32 |
|
modules/__pycache__/result_table.cpython-310.pyc
CHANGED
|
Binary files a/modules/__pycache__/result_table.cpython-310.pyc and b/modules/__pycache__/result_table.cpython-310.pyc differ
|
|
|
modules/result_table.py
CHANGED
|
@@ -1,128 +1,77 @@
|
|
| 1 |
import streamlit as st
|
|
|
|
| 2 |
|
| 3 |
def show_table(p1_df, p2_df):
|
| 4 |
-
|
| 5 |
-
col1, col2 = st.columns([1, 1])
|
| 6 |
-
with col1:
|
| 7 |
st.write("------------------")
|
| 8 |
-
|
| 9 |
-
st.dataframe(
|
| 10 |
-
p1_df[["similarity", "iati_id", "title_main", "orga_abbreviation", "client", "description_main", "country", "sgd_pred_code", "crs_3_code", "crs_5_code"]],
|
| 11 |
-
use_container_width = True,
|
| 12 |
-
height = 35 + 35 * len(p1_df),
|
| 13 |
-
column_config={
|
| 14 |
-
"similarity": st.column_config.TextColumn(
|
| 15 |
-
"Similarity",
|
| 16 |
-
help="simialrity",
|
| 17 |
-
disabled=True
|
| 18 |
-
),
|
| 19 |
-
"iati_id": st.column_config.TextColumn(
|
| 20 |
-
"IATI ID",
|
| 21 |
-
help="IATI Project ID",
|
| 22 |
-
disabled=True
|
| 23 |
-
),
|
| 24 |
-
"orga_abbreviation": st.column_config.TextColumn(
|
| 25 |
-
"Organization",
|
| 26 |
-
help="If description not in English, description in other language provided",
|
| 27 |
-
disabled=True
|
| 28 |
-
),
|
| 29 |
-
"client": st.column_config.TextColumn(
|
| 30 |
-
"Client",
|
| 31 |
-
help="Client organization of customer",
|
| 32 |
-
disabled=True
|
| 33 |
-
),
|
| 34 |
-
"title_main": st.column_config.TextColumn(
|
| 35 |
-
"Title",
|
| 36 |
-
help="If title not in English, title in other language provided",
|
| 37 |
-
disabled=True
|
| 38 |
-
),
|
| 39 |
-
"description_main": st.column_config.TextColumn(
|
| 40 |
-
"Description",
|
| 41 |
-
help="If description not in English, description in other language provided",
|
| 42 |
-
disabled=True
|
| 43 |
-
),
|
| 44 |
-
"country": st.column_config.TextColumn(
|
| 45 |
-
"Country",
|
| 46 |
-
help="Country of project",
|
| 47 |
-
disabled=True
|
| 48 |
-
),
|
| 49 |
-
"sgd_pred_code": st.column_config.TextColumn(
|
| 50 |
-
"SDG Prediction",
|
| 51 |
-
help="Prediction of SDG's",
|
| 52 |
-
disabled=True
|
| 53 |
-
),
|
| 54 |
-
"crs_3_code": st.column_config.TextColumn(
|
| 55 |
-
"CRS 3",
|
| 56 |
-
help="CRS 3 code given by organization",
|
| 57 |
-
disabled=True
|
| 58 |
-
),
|
| 59 |
-
"crs_5_code": st.column_config.TextColumn(
|
| 60 |
-
"CRS 5",
|
| 61 |
-
help="CRS 5 code given by organization",
|
| 62 |
-
disabled=True
|
| 63 |
-
),
|
| 64 |
-
},
|
| 65 |
-
hide_index=True,
|
| 66 |
-
)
|
| 67 |
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
import pandas as pd
|
| 3 |
|
| 4 |
def show_table(p1_df, p2_df):
|
|
|
|
|
|
|
|
|
|
| 5 |
st.write("------------------")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
+
p1_df = p1_df.reset_index(drop=True)
|
| 8 |
+
p2_df = p2_df.reset_index(drop=True)
|
| 9 |
+
|
| 10 |
+
for i in range(len(p1_df) - 1, -1, -2):
|
| 11 |
+
match_df = pd.DataFrame()
|
| 12 |
+
row_from_p1 = p1_df.iloc[[i]]
|
| 13 |
+
row_from_p2 = p2_df.iloc[[i]]
|
| 14 |
+
|
| 15 |
+
# Correctly append rows to match_df
|
| 16 |
+
match_df = pd.concat([row_from_p1, row_from_p2], ignore_index=True)
|
| 17 |
+
|
| 18 |
+
st.dataframe(
|
| 19 |
+
match_df[["similarity", "iati_id", "title_main", "orga_abbreviation", "client", "description_main", "country", "sgd_pred_code", "crs_3_code", "crs_5_code"]],
|
| 20 |
+
use_container_width = True,
|
| 21 |
+
height = 35 + 35 * len(match_df),
|
| 22 |
+
column_config={
|
| 23 |
+
"similarity": st.column_config.TextColumn(
|
| 24 |
+
"Similarity",
|
| 25 |
+
help="simialrity",
|
| 26 |
+
disabled=True
|
| 27 |
+
),
|
| 28 |
+
"iati_id": st.column_config.TextColumn(
|
| 29 |
+
"IATI ID",
|
| 30 |
+
help="IATI Project ID",
|
| 31 |
+
disabled=True
|
| 32 |
+
),
|
| 33 |
+
"orga_abbreviation": st.column_config.TextColumn(
|
| 34 |
+
"Organization",
|
| 35 |
+
help="If description not in English, description in other language provided",
|
| 36 |
+
disabled=True
|
| 37 |
+
),
|
| 38 |
+
"client": st.column_config.TextColumn(
|
| 39 |
+
"Client",
|
| 40 |
+
help="Client organization of customer",
|
| 41 |
+
disabled=True
|
| 42 |
+
),
|
| 43 |
+
"title_main": st.column_config.TextColumn(
|
| 44 |
+
"Title",
|
| 45 |
+
help="If title not in English, title in other language provided",
|
| 46 |
+
disabled=True
|
| 47 |
+
),
|
| 48 |
+
"description_main": st.column_config.TextColumn(
|
| 49 |
+
"Description",
|
| 50 |
+
help="If description not in English, description in other language provided",
|
| 51 |
+
disabled=True
|
| 52 |
+
),
|
| 53 |
+
"country": st.column_config.TextColumn(
|
| 54 |
+
"Country",
|
| 55 |
+
help="Country of project",
|
| 56 |
+
disabled=True
|
| 57 |
+
),
|
| 58 |
+
"sgd_pred_code": st.column_config.TextColumn(
|
| 59 |
+
"SDG Prediction",
|
| 60 |
+
help="Prediction of SDG's",
|
| 61 |
+
disabled=True
|
| 62 |
+
),
|
| 63 |
+
"crs_3_code": st.column_config.TextColumn(
|
| 64 |
+
"CRS 3",
|
| 65 |
+
help="CRS 3 code given by organization",
|
| 66 |
+
disabled=True
|
| 67 |
+
),
|
| 68 |
+
"crs_5_code": st.column_config.TextColumn(
|
| 69 |
+
"CRS 5",
|
| 70 |
+
help="CRS 5 code given by organization",
|
| 71 |
+
disabled=True
|
| 72 |
+
),
|
| 73 |
+
},
|
| 74 |
+
hide_index=True,
|
| 75 |
+
)
|
| 76 |
+
|
| 77 |
+
st.write("------------------")
|