Jan Mühlnikel
commited on
Commit
·
2080e6b
1
Parent(s):
8313af9
enhanced documentation
Browse files
modules/multimatch_result_table.py
CHANGED
|
@@ -1,14 +1,24 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import pandas as pd
|
| 3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
def show_multi_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 |
actual_ind = 0
|
| 11 |
-
|
|
|
|
|
|
|
| 12 |
actual_ind += 1
|
| 13 |
match_df = pd.DataFrame()
|
| 14 |
row_from_p1 = p1_df.iloc[[i]]
|
|
@@ -16,6 +26,12 @@ def show_multi_table(p1_df, p2_df):
|
|
| 16 |
|
| 17 |
# INTEGRATE IN PREPROCESSING !!!
|
| 18 |
# transform strings to list
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
try:
|
| 20 |
row_from_p1["crs_3_code_list"] = [row_from_p1['crs_3_name'].item().split(";")[:-1]]
|
| 21 |
row_from_p2["crs_3_code_list"] = [row_from_p2['crs_3_name'].item().split(";")[:-1]]
|
|
@@ -40,14 +56,13 @@ def show_multi_table(p1_df, p2_df):
|
|
| 40 |
row_from_p1["flag"] = "https://flagicons.lipis.dev/flags/4x3/xx.svg"
|
| 41 |
row_from_p2["flag"] = "https://flagicons.lipis.dev/flags/4x3/xx.svg"
|
| 42 |
|
| 43 |
-
#print(row_from_p1["flag"].item())
|
| 44 |
|
| 45 |
-
#
|
| 46 |
-
#st.subheader(f"#{actual_ind}")
|
| 47 |
-
#st.caption(f"Similarity: {round(row_from_p1['similarity'].item(), 4) * 100}%")
|
| 48 |
match_df = pd.concat([row_from_p1, row_from_p2], ignore_index=True)
|
| 49 |
|
| 50 |
col1, col2 = st.columns([1, 12])
|
|
|
|
|
|
|
| 51 |
with col1:
|
| 52 |
|
| 53 |
# remove arrow from standart st.metric()
|
|
@@ -64,6 +79,7 @@ def show_multi_table(p1_df, p2_df):
|
|
| 64 |
|
| 65 |
st.metric(label="Match", value=f"{actual_ind}", delta=f"~ {str(round(row_from_p1['similarity'].item(), 5) * 100)[:4]} %")
|
| 66 |
|
|
|
|
| 67 |
with col2:
|
| 68 |
st.write(" ")
|
| 69 |
st.dataframe(
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import pandas as pd
|
| 3 |
|
| 4 |
+
"""
|
| 5 |
+
Result table of the Multi Project Matching
|
| 6 |
+
"""
|
| 7 |
+
|
| 8 |
def show_multi_table(p1_df, p2_df):
|
| 9 |
+
"""
|
| 10 |
+
p1_df & p2_df from functions/multi_project_matching
|
| 11 |
+
"""
|
| 12 |
+
|
| 13 |
st.write("------------------")
|
| 14 |
|
| 15 |
p1_df = p1_df.reset_index(drop=True)
|
| 16 |
p2_df = p2_df.reset_index(drop=True)
|
| 17 |
|
| 18 |
actual_ind = 0
|
| 19 |
+
|
| 20 |
+
# Loop to displaye every matching pair from p1 and p2 dfs
|
| 21 |
+
for i in range(len(p1_df) - 1, -1, -2): # stepsize 2 to not display duplicates
|
| 22 |
actual_ind += 1
|
| 23 |
match_df = pd.DataFrame()
|
| 24 |
row_from_p1 = p1_df.iloc[[i]]
|
|
|
|
| 26 |
|
| 27 |
# INTEGRATE IN PREPROCESSING !!!
|
| 28 |
# transform strings to list
|
| 29 |
+
"""
|
| 30 |
+
Add this to preprocessing
|
| 31 |
+
- flag url
|
| 32 |
+
- crs code lists
|
| 33 |
+
"""
|
| 34 |
+
|
| 35 |
try:
|
| 36 |
row_from_p1["crs_3_code_list"] = [row_from_p1['crs_3_name'].item().split(";")[:-1]]
|
| 37 |
row_from_p2["crs_3_code_list"] = [row_from_p2['crs_3_name'].item().split(";")[:-1]]
|
|
|
|
| 56 |
row_from_p1["flag"] = "https://flagicons.lipis.dev/flags/4x3/xx.svg"
|
| 57 |
row_from_p2["flag"] = "https://flagicons.lipis.dev/flags/4x3/xx.svg"
|
| 58 |
|
|
|
|
| 59 |
|
| 60 |
+
# concat p1_df and p2_df rows
|
|
|
|
|
|
|
| 61 |
match_df = pd.concat([row_from_p1, row_from_p2], ignore_index=True)
|
| 62 |
|
| 63 |
col1, col2 = st.columns([1, 12])
|
| 64 |
+
|
| 65 |
+
# MATCHING INFOS
|
| 66 |
with col1:
|
| 67 |
|
| 68 |
# remove arrow from standart st.metric()
|
|
|
|
| 79 |
|
| 80 |
st.metric(label="Match", value=f"{actual_ind}", delta=f"~ {str(round(row_from_p1['similarity'].item(), 5) * 100)[:4]} %")
|
| 81 |
|
| 82 |
+
# MATCHING Project Informations as table
|
| 83 |
with col2:
|
| 84 |
st.write(" ")
|
| 85 |
st.dataframe(
|