Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -633,6 +633,16 @@ def analyze_excel_single(file_path):
|
|
| 633 |
if trustbuilder_present:
|
| 634 |
# Create dataframe for trust builder
|
| 635 |
results_df_builder = pd.read_csv(csv_output_path_trustbuilder)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 636 |
combined_data = {
|
| 637 |
"Message": results_df_builder["Message"],
|
| 638 |
"Stability": results_df_builder["Stability"].round(0).astype(int),
|
|
@@ -645,8 +655,12 @@ def analyze_excel_single(file_path):
|
|
| 645 |
|
| 646 |
df_builder = pd.DataFrame(combined_data)
|
| 647 |
|
| 648 |
-
|
| 649 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 650 |
bucket_columns = [
|
| 651 |
"Stability",
|
| 652 |
"Development",
|
|
@@ -656,11 +670,6 @@ def analyze_excel_single(file_path):
|
|
| 656 |
"Competence",
|
| 657 |
]
|
| 658 |
|
| 659 |
-
# Prepare lists to collect data
|
| 660 |
-
buckets = []
|
| 661 |
-
messages = []
|
| 662 |
-
percentages = []
|
| 663 |
-
|
| 664 |
# Iterate through each bucket column
|
| 665 |
for bucket in bucket_columns:
|
| 666 |
for index, value in results_df_builder[bucket].items():
|
|
@@ -675,8 +684,11 @@ def analyze_excel_single(file_path):
|
|
| 675 |
"TrustBuilders®": messages,
|
| 676 |
"%": percentages,
|
| 677 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 678 |
|
| 679 |
-
df_builder_pivot = pd.DataFrame(builder_consolidated)
|
| 680 |
|
| 681 |
# Define the order of the Trust Bucket® categories
|
| 682 |
trust_driver_order = [
|
|
@@ -708,12 +720,6 @@ def analyze_excel_single(file_path):
|
|
| 708 |
)
|
| 709 |
|
| 710 |
|
| 711 |
-
#df_builder_pivot = df_builder_pivot.sort_values(
|
| 712 |
-
# by=["%"], ascending=[False]
|
| 713 |
-
#)
|
| 714 |
-
#df_builder_pivot = df_builder_pivot.head(4)
|
| 715 |
-
|
| 716 |
-
|
| 717 |
# After processing, ensure to delete the temporary files and directory
|
| 718 |
os.remove(csv_output_path_trust)
|
| 719 |
if nps_present:
|
|
@@ -723,7 +729,7 @@ def analyze_excel_single(file_path):
|
|
| 723 |
if consideration_present:
|
| 724 |
os.remove(csv_output_path_consideration)
|
| 725 |
if satisfaction_present:
|
| 726 |
-
os.remove(
|
| 727 |
if trustbuilder_present:
|
| 728 |
os.remove(csv_output_path_trustbuilder)
|
| 729 |
os.remove(text_output_path)
|
|
|
|
| 633 |
if trustbuilder_present:
|
| 634 |
# Create dataframe for trust builder
|
| 635 |
results_df_builder = pd.read_csv(csv_output_path_trustbuilder)
|
| 636 |
+
bucket_colors = {
|
| 637 |
+
"Stability": "lightblue",
|
| 638 |
+
"Development": "lightgreen",
|
| 639 |
+
"Relationship": "lavender",
|
| 640 |
+
"Benefit": "lightyellow",
|
| 641 |
+
"Vision": "orange",
|
| 642 |
+
"Competence": "lightcoral",
|
| 643 |
+
}
|
| 644 |
+
|
| 645 |
+
|
| 646 |
combined_data = {
|
| 647 |
"Message": results_df_builder["Message"],
|
| 648 |
"Stability": results_df_builder["Stability"].round(0).astype(int),
|
|
|
|
| 655 |
|
| 656 |
df_builder = pd.DataFrame(combined_data)
|
| 657 |
|
| 658 |
+
|
| 659 |
+
|
| 660 |
+
# Prepare lists to collect data
|
| 661 |
+
buckets = []
|
| 662 |
+
messages = []
|
| 663 |
+
percentages = []
|
| 664 |
bucket_columns = [
|
| 665 |
"Stability",
|
| 666 |
"Development",
|
|
|
|
| 670 |
"Competence",
|
| 671 |
]
|
| 672 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 673 |
# Iterate through each bucket column
|
| 674 |
for bucket in bucket_columns:
|
| 675 |
for index, value in results_df_builder[bucket].items():
|
|
|
|
| 684 |
"TrustBuilders®": messages,
|
| 685 |
"%": percentages,
|
| 686 |
}
|
| 687 |
+
df_builder_pivot = pd.DataFrame(builder_consolidated).style.applymap(
|
| 688 |
+
lambda _: f"background-color: {bucket_colors.get(_, '')}",
|
| 689 |
+
subset=list(bucket_colors.keys())
|
| 690 |
+
)
|
| 691 |
|
|
|
|
| 692 |
|
| 693 |
# Define the order of the Trust Bucket® categories
|
| 694 |
trust_driver_order = [
|
|
|
|
| 720 |
)
|
| 721 |
|
| 722 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 723 |
# After processing, ensure to delete the temporary files and directory
|
| 724 |
os.remove(csv_output_path_trust)
|
| 725 |
if nps_present:
|
|
|
|
| 729 |
if consideration_present:
|
| 730 |
os.remove(csv_output_path_consideration)
|
| 731 |
if satisfaction_present:
|
| 732 |
+
os.remove(csv_output_path_satisfaction)
|
| 733 |
if trustbuilder_present:
|
| 734 |
os.remove(csv_output_path_trustbuilder)
|
| 735 |
os.remove(text_output_path)
|