IP Project I
IP Project I
1. SYNOPSIS
The idea of this project is to analyze the data and predict the probable type of customers that would
not leave their credit card sevices.
1
CREDIT CARD DATA ANALYSIS
2.USER MANUAL
2.1 HARDWARE REQUIREMENTS
2
CREDIT CARD DATA ANALYSIS
Python is a dynamic, object-oriented programming language that can be used for many kinds of software
development. It offers strong support for integration with other languages and tools, comes with extensive
standard libraries, and can be learned in a few days. Many Python programmers report substantial productivity
gains and feel the language encourages the development of better code.
Python is the language used to build the Django framework. It is a dynamic scripting language similar to
Perl and Ruby. The principal author of Python is Guido van Rossum. Python supports dynamic typing and has a
garbage collector for automatic memory management. Another important feature of Python is dynamic name
solution which binds the names of functions and variables during execution.
Pandas has so many uses that it might make sense to list the things it can't do instead of what it can do.
This tool is essentially your data’s home. Through pandas, you get acquainted with your data by cleaning,
transforming, and analyzing it.
For example, say you want to explore a dataset stored in a CSV on your computer. Pandas will extract the
data from that CSV into a DataFrame — a table, basically — then let you do things like:
3
CREDIT CARD DATA ANALYSIS
Store the cleaned, transformed data back into a CSV, other file or database
To import pandas we usually import it with a shorter name since it's used so
much:
Matplotlib
Matplotlib is an amazing visualization library in Python for 2D plots of arrays. Matplotlib is a multi-
platform data visualization library built on NumPy arrays and designed to work with the broader SciPy stack. It
was introduced by John Hunter in the year 2002.
One of the greatest benefits of visualization is that it allows us visual access to huge amounts of data in
easily digestible visuals. Matplotlib consists of several plots like line, bar, scatter, histogram etc.
matplotlib.pyplot is a collection of command style functions that make matplotlib work like MATLAB.
Each pyplot function makes some change to a figure: e.g., creates a figure, creates a plotting area in a figure,
plots some lines in a plotting area, decorates the plot with labels, etc.
In matplotlib.pyplot various states are preserved across function calls, so that it keeps track of things like the
current figure and plotting area, and the plotting functions are directed to the current axes (please note that
"axes" here and in most places in the documentation refers to the axes part of a figure and not the strict
mathematical term for more than one axis).
4
CREDIT CARD DATA ANALYSIS
python-mpipinstall-Upip
python-mpipinstall-Umatplotlib
4. Modules
MODULES USED :
Functions in teacher.py
5
CREDIT CARD DATA ANALYSIS
6
CREDIT CARD DATA ANALYSIS
5. LIMITATIONS
List of Limitations which are available in CREDIT CARD ANALYSIS
Report is not generated
Product code is not genereated automatically
No online support
It supports only single organization
Authentication phase is not created
7
CREDIT CARD DATA ANALYSIS
7.SOURCE CODE
import pandas as pd
import time
import sqlalchemy
df = pd.DataFrame()
csv_file = "d:/sathya/BankChurners.csv"
def introduction():
msg = '''
A manager at the bank is disturbed with more and more customers leaving their credit card services.
They would really appreciate if one could predict for them who is gonna get churned so they can
proactively go to the customer to provide them better services and turn customers' decisions in
I got this dataset from a website with the URL as https://leaps.analyttica.com/home. I have been
using this for a while to get datasets and accordingly work on them to produce fruitful results.
8
CREDIT CARD DATA ANALYSIS
Now, this dataset consists of 10,000 customers mentioning their age, salary, marital_status,
credit card limit, credit card category, etc. There are nearly 18 features.
We have only 16.07 % of customers who have churned. Thus, it's a bit difficult to train our model
In this project we are going to analyse the same dataset using Python Pandas on windows machine but
the project can be run on any machine support Python and Pandas. Besides pandas we also used
The whole project is divided into four major parts ie reading, analysis, visualization and export. all
these
for x in msg:
9
CREDIT CARD DATA ANALYSIS
print(x, end='')
time.sleep(0.002)
def made_by():
msg = '''
Roll No : 1234
session : 2020-21
\n\n\n
'''
for x in msg:
print(x, end='')
time.sleep(0.002)
10
CREDIT CARD DATA ANALYSIS
def read_csv_file():
df = pd.read_csv(csv_file)
print(df)
def clear():
for x in range(65):
print()
def data_analysis_menu():
df = pd.read_csv(csv_file)
while True:
clear()
11
CREDIT CARD DATA ANALYSIS
print('\n\nD A T A A N A L Y S I S M E N U ')
print('_'*100,'\n')
if ch == 1:
print(df)
if ch == 2:
12
CREDIT CARD DATA ANALYSIS
print(df.columns)
if ch == 3:
print(df.head(n))
if ch == 4:
print(df.tail(n))
if ch == 5:
print(df.columns)
print(df[col_name])
if ch == 6:
13
CREDIT CARD DATA ANALYSIS
14
CREDIT CARD DATA ANALYSIS
'Income_Category':h,'Card_Category':i,'Months_on_book':j,'Total_Relationship_count':k,
'Month_Inactive_12_month':l,'Contacts_count_12_mon':m,'Credit_Limit':n,
'Total_Revolving_Bal':o,'Avg_Open_To_Buy':p,'Total_Amt_chng_Q4_Q1':q,'Total_Trans_Amt':r,
'Total_Trans_Ct':s,'Total_Ct_Chng_Q4_Q1':t,'Average_Utilization_Ration':u }
df = df.append(data, ignore_index=True)
print(df)
if ch == 7:
df[col_name] = col_value
print(df)
wait = input()
if ch == 8:
del df[col_name]
print(df)
15
CREDIT CARD DATA ANALYSIS
wait = input()
if ch == 9:
index_no = int(
df = df.drop(df.index[index_no])
print(df)
wait = input()
if ch == 10:
print(df.columns)
print(df['Type'].unique())
g = df.groupby('Type')
print(g['Type'].count())
wait = input()
16
CREDIT CARD DATA ANALYSIS
if ch == 11:
df1 = df.Gender.unique()
print('\n\n')
print(df1)
wait = input()
if ch == 12:
print(df.describe())
wait = input()
if ch == 13:
break
17
CREDIT CARD DATA ANALYSIS
def graph():
df = pd.read_csv(csv_file)
while True:
clear()
print('_'*100)
if ch == 1:
g = df.groupby('Gender')
x = df['Gender'].unique()
y = g['Gender'].count()
#plt.xticks(rotation='vertical')
18
CREDIT CARD DATA ANALYSIS
plt.xlabel('Gender')
plt.grid(True)
plt.show()
if ch == 2:
g = df.groupby('Gender')
x = df['Gender'].unique()
y = g['Gender'].count()
#plt.xticks(rotation='vertical')
plt.xlabel('Gender')
plt.grid(True)
plt.show()
wait = input()
19
CREDIT CARD DATA ANALYSIS
if ch == 3:
g = df.groupby('Gender')
x = df['Gender'].unique()
y = g['Gender'].count()
#plt.xticks(rotation='vertical')
plt.xlabel('Gender')
plt.grid(True)
plt.scatter(x, y)
plt.show()
wait = input()
if ch == 4:
g = df.groupby("Card_Category")
x = df['Card_Category'].unique()
y = g['Card_Category'].count()
plt.xticks(rotation='vertical')
plt.show()
20
CREDIT CARD DATA ANALYSIS
if ch == 5:
g = df.groupby("Education_Level")
x = df['Education_Level'].unique()
y = g['Education_Level'].count()
plt.bar(x, y)
#plt.xticks(rotation='vertical')
plt.grid(True)
plt.xlabel('Education Level')
plt.show()
wait = input()
if ch == 6:
g = df.groupby("Income_Category")
x = df['Income_Category'].unique()
y = g['Income_Category'].count()
plt.grid(True)
plt.xlabel('Income Group')
21
CREDIT CARD DATA ANALYSIS
plt.ylabel('Card Users')
plt.bar(x,y)
plt.show()
if ch == 7:
break
def export_menu():
df = pd.read_csv(csv_file)
while True:
clear()
print('_'*100)
print()
22
CREDIT CARD DATA ANALYSIS
if ch == 1:
df.to_csv('c:/backup/bankchurner_backup.csv')
if ch == 2:
df.to_excel('c:/backup/bankchurner_backup.xlsx')
if ch == 3:
break
def main_menu():
clear()
introduction()
while True:
clear()
23
CREDIT CARD DATA ANALYSIS
print('_'*100)
print()
print('5. Exit\n')
if choice == 1:
read_csv_file()
wait = input(
if choice == 2:
data_analysis_menu()
if choice == 3:
24
CREDIT CARD DATA ANALYSIS
graph()
if choice == 4:
export_menu()
wait = input(
if choice == 5:
break
clear()
made_by()
main_menu()
25
CREDIT CARD DATA ANALYSIS
8. SCREEN LAYOUT
IDLE:
1.Introduction
26
CREDIT CARD DATA ANALYSIS
27
CREDIT CARD DATA ANALYSIS
28
CREDIT CARD DATA ANALYSIS
5.Show Columns
29
CREDIT CARD DATA ANALYSIS
30
CREDIT CARD DATA ANALYSIS
31
CREDIT CARD DATA ANALYSIS
32
CREDIT CARD DATA ANALYSIS
33
CREDIT CARD DATA ANALYSIS
34
CREDIT CARD DATA ANALYSIS
35
CREDIT CARD DATA ANALYSIS
11.Delete a Column
36
CREDIT CARD DATA ANALYSIS
12.Delete a Record
37
CREDIT CARD DATA ANALYSIS
38
CREDIT CARD DATA ANALYSIS
39
CREDIT CARD DATA ANALYSIS
15.Data Summary
40
CREDIT CARD DATA ANALYSIS
41
CREDIT CARD DATA ANALYSIS
16.Exit
17.Graph Menu
42
CREDIT CARD DATA ANALYSIS
43
CREDIT CARD DATA ANALYSIS
44
CREDIT CARD DATA ANALYSIS
45
CREDIT CARD DATA ANALYSIS
46
CREDIT CARD DATA ANALYSIS
47
CREDIT CARD DATA ANALYSIS
48
CREDIT CARD DATA ANALYSIS
49
CREDIT CARD DATA ANALYSIS
24.Exit
25.Export Data
50
CREDIT CARD DATA ANALYSIS
26.CSV File
27.Excel File
51
CREDIT CARD DATA ANALYSIS
28.Exit
52
CREDIT CARD DATA ANALYSIS
29.Exit
53
CREDIT CARD DATA ANALYSIS
9. CONCLUSION
54
CREDIT CARD DATA ANALYSIS
10. BIBLIOGRAPHY
In order to work on this project titled – CREDIT CARD DATA ANALYSIS, the following books
and literature are refered by me during the various phases of development of the project.
55
CREDIT CARD DATA ANALYSIS
Reference Books:
Informatics Practices with Pyhton:-Sumita Arora.
Reference Websites:
www.python.org
www.tutorialspoint.com
www.w3schools.com
www.docs.python.org
www.freehtmltemplates.com
www.google.com/Python project
www.wikepedia.com/Python and Pandas projects
www.data.world
www.youTube.com
56