Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -707,19 +707,36 @@ def analyze_excel_single(file_path):
|
|
| 707 |
df_builder_pivot = df_builder_pivot.sort_values(
|
| 708 |
by=["Trust Bucket®", "%"], ascending=[True, False]
|
| 709 |
)
|
| 710 |
-
|
| 711 |
-
|
| 712 |
-
|
| 713 |
-
|
| 714 |
-
|
| 715 |
-
|
| 716 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 717 |
|
| 718 |
|
| 719 |
|
|
|
|
| 720 |
|
| 721 |
|
| 722 |
-
|
|
|
|
|
|
|
|
|
|
| 723 |
|
| 724 |
|
| 725 |
# After processing, ensure to delete the temporary files and directory
|
|
|
|
| 707 |
df_builder_pivot = df_builder_pivot.sort_values(
|
| 708 |
by=["Trust Bucket®", "%"], ascending=[True, False]
|
| 709 |
)
|
| 710 |
+
bucket_colors = {
|
| 711 |
+
"Stability": "#FFDDC1", # Light Orange
|
| 712 |
+
"Development": "#D4E157", # Light Green
|
| 713 |
+
"Relationship": "#64B5F6", # Light Blue
|
| 714 |
+
"Benefit": "#BA68C8", # Light Purple
|
| 715 |
+
"Vision": "#FFD54F", # Yellow
|
| 716 |
+
"Competence": "#81C784", # Light Teal
|
| 717 |
+
}
|
| 718 |
+
def apply_bucket_color(row):
|
| 719 |
+
bucket = row["Trust Bucket®"]
|
| 720 |
+
color = bucket_colors.get(bucket, "#FFFFFF") # Default to white if bucket not found
|
| 721 |
+
return [f"background-color: {color}" if col == "Trust Bucket®" else "" for col in row.index]
|
| 722 |
+
|
| 723 |
+
# Optionally, to color the entire row:
|
| 724 |
+
def apply_row_color(row):
|
| 725 |
+
bucket = row["Trust Bucket®"]
|
| 726 |
+
color = bucket_colors.get(bucket, "#FFFFFF")
|
| 727 |
+
return [f"background-color: {color}" for _ in row.index
|
| 728 |
+
styled_table = df_builder_pivot.style.apply(apply_bucket_color, axis=1)
|
| 729 |
+
styled_table.set_table_attributes('style="font-size: 14px; border-collapse: collapse;"').to_html("styled_table.html")
|
| 730 |
|
| 731 |
|
| 732 |
|
| 733 |
+
|
| 734 |
|
| 735 |
|
| 736 |
+
#df_builder_pivot = df_builder_pivot.sort_values(
|
| 737 |
+
# by=["%"], ascending=[False]
|
| 738 |
+
#)
|
| 739 |
+
#df_builder_pivot = df_builder_pivot.head(4)
|
| 740 |
|
| 741 |
|
| 742 |
# After processing, ensure to delete the temporary files and directory
|