text_plain_output_1.png
from scipy.stats import f_oneway

from sklearn.compose import ColumnTransformer

from sklearn.preprocessing import OneHotEncoder

import numpy as np #to perform arithmetic operation

import pandas as pd #to handle the dataframe

data = pd.read_csv('/kaggle/input/churn-predictions-personal/Churn_Predictions.csv')

data.isnull().sum()
' It\'s alaways necessary to check for the missing values. "Nan" is not always missing values. Missing values can be present in other format also.\nFeature can also have 0\'s which can also be treated as missing values for some particular dataset. Here in this case we dont have any missing value present \nin the dataset which saves a lot of time'

"""We can also check the top N customers based on their current account balance. Here 1 means left 0 means still with the bank"""
top_N = data.nlargest(20, 'Balance')
bottom_N = data.nsmallest(20, 'Balance')

from scipy.stats import f_oneway
grouped_data = data.groupby('Exited')['Age'].apply(list)
f_statistic, p_value = f_oneway(*grouped_data)

data.corr()

X = data.iloc[:, 3:-1].values
y = data.iloc[:, -1].values

"""Here 001 represent spain
100 represent france
010 represent germany"""
from sklearn.compose import ColumnTransformer
from sklearn.preprocessing import OneHotEncoder
ct = ColumnTransformer(transformers=[('encoder', OneHotEncoder(), [1])], remainder='passthrough')
X = np.array(ct.fit_transform(X))
X = np.delete(X, 0, axis=1)
print(X)