Skip to content

Commit

Permalink
Update dashboard_CLOUD.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Isdinval authored Jun 6, 2024
1 parent 9ab9ac1 commit 17745e8
Showing 1 changed file with 31 additions and 30 deletions.
61 changes: 31 additions & 30 deletions dashboard_CLOUD.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,36 +290,37 @@ def main():
# ========================================================================
# Generate graph
st.header('Comparative Analysis')

    # Get all features (assuming numerical features)
    all_features = customer_data_copy.select_dtypes(include=[np.number]) # Adjust for categorical features if needed

    # Filter controls
    selected_feature = st.selectbox('Select Feature:', all_features.columns)

    # Filter data based on selected feature
    filtered_data = customer_data_copy.copy() # Avoid modifying original data

    # 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

    # 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)

    plt.xlabel('Customer Index')
    plt.ylabel(selected_feature)
    plt.title(f'{selected_feature} Distribution')
    plt.legend()
    plt.tight_layout()
    st.pyplot(plt.gcf())

# Get all features (assuming numerical features)
all_features = customer_data_copy.select_dtypes(include=[np.number]) # Adjust for categorical features if needed

# Filter controls
selected_feature = st.selectbox('Select Feature:', all_features.columns)

# Filter data based on selected feature
filtered_data = customer_data_copy.copy() # Avoid modifying original data

# 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

# 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)

plt.xlabel('Customer Index')
plt.ylabel(selected_feature)
plt.title(f'{selected_feature} Distribution')
plt.legend()
plt.tight_layout()
st.pyplot(plt.gcf())



# =========================================================================
Expand Down

0 comments on commit 17745e8

Please sign in to comment.