image_output_1.png
import matplotlib.pyplot as plt

import numpy as np

import pandas as pd

import seaborn as sns

data = pd.read_csv('../input/Wholesale customers data.csv')
data.shape

data.describe().T

pd.isnull(data).sum()

data.Region.value_counts()

data.Channel.value_counts()

dataset = data.copy()

def continous_data(i):
    if dataset[i].dtype != 'object':
        plt.clf()

sns.set()
j = ['Fresh', 'Milk', 'Grocery', 'Frozen', 'Detergents_Paper', 'Delicassen']
for k in j:
    continous_data(i=k)

log_data = np.log(dataset[['Fresh', 'Milk', 'Grocery', 'Frozen', 'Detergents_Paper', 'Delicassen']].copy())

def categorical_data(i):
    pass
j_1 = ['Channel', 'Region']
for k in j_1:
    categorical_data(i=k)

dataset.corr()

def scatterplot(i, j):
    pass

def categorical_multi(i, j):
    pass
categorical_multi(i='Channel', j='Region')

list(log_data.columns)

for k in list(log_data.columns):
    IQR = np.percentile(log_data[k], 75) - np.percentile(log_data[k], 25)
    Outlier_top = np.percentile(log_data[k], 75) + 1.5 * IQR
    Outlier_bottom = np.percentile(log_data[k], 25) - 1.5 * IQR
    log_data[k] = np.where(log_data[k] > Outlier_top, Outlier_top, log_data[k])
    log_data[k] = np.where(log_data[k] < Outlier_bottom, Outlier_bottom, log_data[k])

def continous_data(i):
    if log_data[i].dtype != 'object':
        log_data[i].plot.kde()
        plt.clf()
for k in j:
    continous_data(i=k)

sns.pairplot(log_data, diag_kind='kde')