From c8c1479135ae46aee1ae1a91191142072d8f2ba2 Mon Sep 17 00:00:00 2001 From: RAYMOND Olivier <34789438+Isdinval@users.noreply.github.com> Date: Thu, 6 Jun 2024 16:37:32 +0200 Subject: [PATCH] Update dashboard_CLOUD.py --- dashboard_CLOUD.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/dashboard_CLOUD.py b/dashboard_CLOUD.py index 7b0daae..28c1c7a 100644 --- a/dashboard_CLOUD.py +++ b/dashboard_CLOUD.py @@ -283,6 +283,7 @@ def main(): # Get the data for the selected customer input_data = customer_data_preprocessed[customer_data_preprocessed['SK_ID_CURR'] == sk_id_curr].iloc[0].to_dict() input_data_copy = customer_data_copy[customer_data_copy['SK_ID_CURR'] == sk_id_curr].iloc[0].to_dict() + # ========================================================================= # COMPARATIVE ANALYSIS USING GRAPHS @@ -302,25 +303,24 @@ def main(): # Separate data for full dataset and current customer full_data_values = customer_data_copy[selected_feature] customer_value = customer_data_copy[selected_feature].iloc[0] - st.write("full_data_values") - st.write(full_data_values) - st.write("customer_value") - st.write(customer_value) - # Create line plot with highlighting - plt.plot(full_data_values, color='gray', label='All Clients', alpha=0.7) # Add transparency for better visibility + # Create bar chart with highlighting + plt.figure(figsize=(20, 12)) # Adjust figure size for better visualization + + # Plot full dataset data with a grey color + plt.bar(range(len(full_data_values)), full_data_values, color='gray', alpha=0.7, label='All Clients') - # Highlight current customer with red dot - plt.scatter(customer_index, customer_value, marker='o', color='red', s=100, label='Current Customer') # Adjust marker size (s) + # Highlight current customer with a red bar + plt.bar(customer_index, customer_value, color='red', label='Current Customer') plt.xlabel('Customer Index') plt.ylabel(selected_feature) plt.title(f'{selected_feature} Distribution') + plt.xticks(range(len(full_data_values)), rotation=45, ha='right') # Rotate x-axis labels for better readability if many customers plt.legend() plt.tight_layout() st.pyplot(plt.gcf()) - # ========================================================================= # CUSTOMERS BASIC INFORMATIONS