Spaces:
Sleeping
Sleeping
import streamlit as st | |
import pandas as pd | |
import seaborn as sns | |
import matplotlib.pyplot as plt | |
import plotly.express as px | |
from PIL import Image | |
st.set_page_config( | |
page_title = 'Customer Churn - EDA', | |
layout = 'wide', | |
initial_sidebar_state = 'expanded' | |
) | |
def run(): | |
# Membuat Judul | |
st.title('Customer Churn Prediction') | |
# Membaut subheader | |
st.subheader('EDA for analysis customer churn') | |
# Membuat garis lurus | |
st.markdown('---') | |
# Menambahkan deskripsi | |
st.write('**Why Churn Important?**') | |
st.write('Churn, or customer churn, refers to the phenomenon where customers discontinue their relationship with a company or brand. It is a critical metric for businesses, particularly in subscription-based or recurring revenue models. Churn can have a significant impact on a companys bottom line, as losing customers means losing potential revenue and the need to acquire new customers to sustain growth.') | |
st.write('There are various reasons why customers churn. It could be due to dissatisfaction with the product or service, poor customer experience, better offers or alternatives from competitors, changes in personal circumstances, or simply a lack of engagement or perceived value. Identifying and understanding the underlying causes of churn is crucial for businesses to develop effective strategies to reduce churn rates') | |
st.write('To mitigate churn, companies employ various retention strategies. These include improving product quality, enhancing customer service and support, personalizing offers and experiences, implementing loyalty programs, and proactively reaching out to at-risk customers. By focusing on customer satisfaction, loyalty, and continuous improvement, businesses can increase customer retention, foster long-term relationships, and ultimately drive sustainable growth.') | |
# Membuat garis lurus | |
st.markdown('---') | |
st.write('In this page, show simple exploration about Customer Churn') | |
# Show DataFrame | |
data = pd.read_csv('https://raw.githubusercontent.com/hilalrd/latihan_b19/master/churn.csv') | |
st.dataframe(data) | |
# membuat plot membership category | |
st.write('### Membership Category') | |
fig = plt.figure(figsize=(15, 7)) | |
sns.countplot(x=data['membership_category'], palette='hsv') | |
st.pyplot(fig) | |
st.write('There are two types of membership (No Membership and Basic Membership) that dominate') | |
# membuat plot avg transaction berdasrkan membercategory | |
st.write('### Average Transaction by Membership Category') | |
fig = plt.figure(figsize=(15, 5)) | |
sns.barplot(data=data, x='membership_category', y='avg_transaction_value') | |
plt.title('Value transaction customer'); | |
st.pyplot(fig) | |
st.write('the biggest transaction come from Platinum and Premium membership') | |
# Membuat Histogram berdasarkan Input user | |
st.write('#### Chose Data Customer Experience') | |
pilihan = st.selectbox('Pilih column : ', ('complaint_status', 'feedback')) | |
fig = plt.figure(figsize=(15, 5)) | |
sns.histplot(data[pilihan], bins=30, kde=True) | |
st.pyplot(fig) | |
# Membuat Plotly plot | |
st.write('#### Correlation - Point in wallet with Average Transaction') | |
fig = px.scatter(data, x='points_in_wallet', y='avg_transaction_value') | |
st.plotly_chart(fig) | |
if __name__== '__main__': | |
run() |