Skip to content

Commit 280d932

Browse files
authored
Merge pull request #6 from Team-Fourth-Dimension/master
EDA
2 parents 3c7acc9 + 7a52563 commit 280d932

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

EDA.py

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import Notebook
2+
import numpy as np
3+
import pandas as pd
4+
import matplotlib.pyplot as plt
5+
import seaborn as sns
6+
7+
cleaned_portfolio, cleaned_profile, offers, transactions = Notebook.cleaning_data()
8+
9+
''' Exploratory Data Analysis '''
10+
11+
# To find out the maximum no of customer's belonging to which age group
12+
def by_age_count(cleaned_profile):
13+
sns.countplot(x="age_by_decade",data=cleaned_profile)
14+
15+
# Gender Distribution of our customer
16+
def by_gender_count(cleaned_profile):
17+
'''cleaned_profile['F'].value_counts()
18+
0 8696
19+
1 6129
20+
21+
cleaned_profile['M'].value_counts()
22+
1 8484
23+
0 6341
24+
25+
cleaned_profile['O'].value_counts()
26+
0 14613
27+
1 212
28+
'''
29+
x = ["F", "M", "O"]
30+
y = [6129,8484,212]
31+
plt.bar(x, y)
32+
33+
# An Overview of what income range facilitates more membership
34+
def by_income_range(cleaned_profile):
35+
sns.countplot(x="income_range",data=cleaned_profile)
36+
37+
def by_member_year(cleaned_profile):
38+
sns.countplot(x="became_member_on",data=cleaned_profile)
39+
40+
# Comparing the Gender-wise distribution of our customer's income
41+
def income_by_gender(cleaned_profile):
42+
x = cleaned_profile[cleaned_profile['F']==1]
43+
y = cleaned_profile[cleaned_profile['M']==1]
44+
z = cleaned_profile[cleaned_profile['O']==1]
45+
sns.kdeplot(x['income'],label='Female')
46+
sns.kdeplot(y['income'],label='Male')
47+
sns.kdeplot(z['income'],label='Other')

0 commit comments

Comments
 (0)