<jupyter_start><jupyter_text>Kaggle: Telco Customer Churn.  1. Demographic: 1a. Which 2 demographics have proven to be the most popular with the telco brand?<jupyter_code>import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
df=pd.read_csv('WA_Fn-UseC_-Telco-Customer-Churn.csv')
df.columns
df.head(10)
df.describe()
df['gender'].value_counts()
df['SeniorCitizen'].value_counts()
df['Partner'].value_counts()
df['Dependents'].value_counts()<jupyter_output><empty_output><jupyter_text>1.a Answer Young citizens are most popular with Telco brand  1.b If the marketing team wanted to increase customer retention, to whom should they target their advertisements to?<jupyter_code>retention= df.groupby(['SeniorCitizen','Dependents','Churn'])['customerID'].count().reset_index()
churn=retention[retention['Churn']=="Yes"]
churn.sort_values(by='customerID', ascending=False)<jupyter_output><empty_output><jupyter_text>1.b Answer The marketing should target Young people  and Senior citizen¶  2. Services: a. Which 3 services are contributing to a higher monthly charge and resulting to customers churning? (Use visualizations in explaining your analysis)<jupyter_code>contract_split = df[[ "customerID", "Contract"]]
sectors = contract_split .groupby ("Contract")
contract_split = pd.DataFrame(sectors["customerID"].count())
contract_split.rename(columns={'customerID':'No. of customers'}, inplace=True)
ax=contract_split[["No. of customers"]].plot.bar(title = 'Customers by Contract Type',legend =True, table = False, 
grid = False,  subplots = False,figsize =(12, 7), color ='#ec838a', 
fontsize = 15, stacked=False)
plt.ylabel('No. of Customers\n',
horizontalalignment="center",fontstyle = "normal", 
fontsize = "large", fontfamily = "sans-serif")
plt.xlabel('\n Contract Type',
horizontalalignment="center",fontstyle = "normal", 
fontsize = "large", fontfamily = "sans-serif")
plt.title('Customers by Contract Type \n',
horizontalalignment="center",fontstyle = "normal", 
fontsize = "18", fontfamily = "sans-serif")
plt.legend(loc='top right', fontsize = "medium")
plt.xticks(rotation=0, horizontalalignment="center")
plt.yticks(rotation=0, horizontalalignment="right")
x_labels = np.array(contract_split[["No. of customers"]])<jupyter_output><empty_output><jupyter_text>2.a Answer Month to Month is Contributing to higher monthly charge resulting to customers churning  b. If the telco was to offer Phone as a standalone service, which type of contract would encourage customer retention?<jupyter_code>phone_service=df.groupby(['PhoneService','Contract','Churn'])['customerID'].count().reset_index()
phone_service[(phone_service['PhoneService']=="Yes")&
             (phone_service['Churn']=="No")
             ]

sns.set_theme(style="ticks", palette="pastel")

sns.boxplot(x='Contract', y='customerID', hue='PhoneService', palette=["m", "g"],
            data=phone_service)
sns.despine(offset=10, trim=True)<jupyter_output><empty_output><jupyter_text>Answer. Month to month contract is the most used by phone service users  3. Payment: (Use visualizations in explaining your analysis) a. If the company was to streamline all its services into 3 bouquet packages, what monthly prices will be appropriate for the following packages to keep customers from churning: i. Basic ii. Plus iii. Premium  b. Should the company strictly go paperless for their monthly billings as a technique of keeping their customers and why?<jupyter_code>payment_method_split = df[[ "customerID", "PaymentMethod"]]
sectors = payment_method_split  .groupby ("PaymentMethod")
payment_method_split  = pd.DataFrame(sectors["customerID"].count())
payment_method_split.rename(columns={'customerID':'No. of customers'}, inplace=True)
ax =  payment_method_split [["No. of customers"]].plot.bar(title = 'Customers by Payment Method', legend =True, table = False, grid = False, subplots = False,  figsize =(15, 10),color ='#ec838a', fontsize = 15, stacked=False)
plt.ylabel('No. of Customers\n',
horizontalalignment="center",fontstyle = "normal", 
fontsize = "large", fontfamily = "sans-serif")
plt.xlabel('\n Contract Type',
horizontalalignment="center",fontstyle = "normal", 
fontsize = "large", fontfamily = "sans-serif")
plt.title('Customers by Payment Method \n',
horizontalalignment="center", fontstyle = "normal", fontsize = "22", fontfamily = "sans-serif")
plt.legend(loc='top right', fontsize = "medium")
plt.xticks(rotation=0, horizontalalignment="center")
plt.yticks(rotation=0, horizontalalignment="right")
x_labels = np.array(payment_method_split [["No. of customers"]])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13592866463679862, 'fraction_numerical': 0.008699434536755112, 'mean_word_length': 7.111111111111111, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '587676', 'license': 'MIT', 'n_tokens_mistral': 1465, 'n_tokens_neox': 1384, 'n_words': 381, 'path': 'ADS-Assignment-4-main.ipynb', 'repo_name': 'Fardhosa/ADS-Assignment-4', 'size': '4598'}