text_plain_output_1.png image_output_1.png
import matplotlib.pyplot as plt

import numpy as np   # it's is core library for numeric and scientific computing

import numpy as np # linear algebra

import pandas as pd  # it's is core library for data manipulation and data analysis

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import seaborn as sns

df = pd.read_csv('/kaggle/input/credit-card-buyers/train data credit card.csv')

df.size

df.shape

df.drop('ID', axis=1, inplace=True)

df.nunique()

df.isnull().sum()

df.isnull().sum()

df.duplicated().sum()

df.drop_duplicates(inplace=True)
df.duplicated().sum()

col = ['Age', 'Vintage', 'Avg_Account_Balance']

col_to_transform = ['Age', 'Vintage', 'Avg_Account_Balance']
df[col_to_transform] = df[col_to_transform].apply(lambda x: np.log(x))

# visualize the transformed data using histograms

fig,axes = plt.subplots(nrows=1 ,ncols=len(col_to_transform),figsize=(15,5))

for i,col in enumerate(col_to_transform):
    axes[i].hist(df[col])
    axes[i].set_xlabel(f'log({col})')
    axes[i].set_ylabel('Frequency')
                       
plt.show()

plt.figure(figsize=(10, 8))
sns.countplot(x='Gender', hue='Is_Active', data=df)