Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
import streamlit as st | |
import pandas as pd | |
def show_table(p1_df, p2_df): | |
st.write("------------------") | |
p1_df = p1_df.reset_index(drop=True) | |
p2_df = p2_df.reset_index(drop=True) | |
for i in range(len(p1_df) - 1, -1, -2): | |
match_df = pd.DataFrame() | |
row_from_p1 = p1_df.iloc[[i]] | |
row_from_p2 = p2_df.iloc[[i]] | |
# Correctly append rows to match_df | |
match_df = pd.concat([row_from_p1, row_from_p2], ignore_index=True) | |
st.dataframe( | |
match_df[["similarity", "iati_id", "title_main", "orga_abbreviation", "client", "description_main", "country", "sgd_pred_code", "crs_3_code", "crs_5_code"]], | |
use_container_width = True, | |
height = 35 + 35 * len(match_df), | |
column_config={ | |
"similarity": st.column_config.TextColumn( | |
"Similarity", | |
help="simialrity", | |
disabled=True | |
), | |
"iati_id": st.column_config.TextColumn( | |
"IATI ID", | |
help="IATI Project ID", | |
disabled=True | |
), | |
"orga_abbreviation": st.column_config.TextColumn( | |
"Organization", | |
help="If description not in English, description in other language provided", | |
disabled=True | |
), | |
"client": st.column_config.TextColumn( | |
"Client", | |
help="Client organization of customer", | |
disabled=True | |
), | |
"title_main": st.column_config.TextColumn( | |
"Title", | |
help="If title not in English, title in other language provided", | |
disabled=True | |
), | |
"description_main": st.column_config.TextColumn( | |
"Description", | |
help="If description not in English, description in other language provided", | |
disabled=True | |
), | |
"country": st.column_config.TextColumn( | |
"Country", | |
help="Country of project", | |
disabled=True | |
), | |
"sgd_pred_code": st.column_config.TextColumn( | |
"SDG Prediction", | |
help="Prediction of SDG's", | |
disabled=True | |
), | |
"crs_3_code": st.column_config.TextColumn( | |
"CRS 3", | |
help="CRS 3 code given by organization", | |
disabled=True | |
), | |
"crs_5_code": st.column_config.TextColumn( | |
"CRS 5", | |
help="CRS 5 code given by organization", | |
disabled=True | |
), | |
}, | |
hide_index=True, | |
) | |
st.write("------------------") |