0% found this document useful (0 votes)
9 views19 pages

Vraj Patel

IP project

Uploaded by

shivam201ds
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views19 pages

Vraj Patel

IP project

Uploaded by

shivam201ds
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

SHREE RAJ RAJESHWARI VIDYA MANDIR

SCHOOL (CBSE), VAPI

Credit Card Analysis

INFORMATICS PRACTICES

CBSE-2024-2025

GUIDED BY SUBMITTED BY
Chintal Patel Vraj Patel
ACKNOWLEDGEMENT

I would like to take this opportunity to express my sincere


gratitude to my teacher Ms. Chintal Patel for her immense
support acknowledgement throughout this IP project. Also
thanks to our principal Dr. Rajeshwari Mam for organizing
this project and creating a helpful environment. I am
extremely grateful for the direction and advice provided bymy
teacher at every stage project which made the completion of
this IP project possible.
CERTIFICATE

This is to certify that Vraj Patel of class XII com has


successfully completed Informatics practical. Under the
guidance of Ms. Chintal Patel (subject teacher) and Dr.
Rajeshwari Mam (principal) as prescribed by central board of
secondary education (CBSE) during the academic session 2024-
25.

Sign of Examiner Sign of Examiner Sign of Examiner


INDEX:

Sr TOPIC
No.
1 What is python
2 Uses of python
3 What is csv
4 About credit card analysis
5 Csv files
6 SOURCE CODE
7 OUTPUT
8 Conclusion

9 Bibliography
What is Python?

Python is a programming language that is easy to learn and use. It’s like giving instructions to a computer in
a simple way that almost anyone can understand. Python is often used to build websites, analyze data, create
games, and even teach robots how to think!

Key Features:

• Simple to Read: Python's code looks like plain English. For example, to print a message, you just
write print ("Hello, world!").

• Flexible: You can use Python for many things, from web apps to data analysis to artificial
intelligence.

• No Need to Declare Types: You don’t have to tell Python what kind of data you're working with. It
figures it out for you.

Example:

Here’s a super simple Python program:


python
Copy code
# This will print "Hello, world!" to the screen
print("Hello, world!")

Why Python is Popular:

• Easy to Learn: You don’t need to memorize complicated rules.

• Used Everywhere: Python is used in web development, data science, AI, and more.

• Huge Community: Lots of people use Python, so it's easy to find help online.

In short, Python is a friendly programming language that’s great for beginners and powerful enough for
experts!
Uses of Python
1. Web Development:Python is widely used to build websites and web applications. There are several
frameworks in Python that make web development easier and faster.

2. Artificial Intelligence (AI) and Machine Learning

Python is the most popular language for artificial intelligence (AI) and machine learning (ML). AI
involves creating programs that can simulate human intelligence, like understanding natural language or
recognizing objects in images

3. Game Development

Although Python isn’t typically used for high-performance video games, it is still used in game
development, especially for simpler 2D games. The library Pygame is specifically designed for creating
games.

4. Desktop GUI Applications

Python can also be used to build desktop applications with graphical user interfaces (GUIs). There are
several libraries that help create windows, buttons, text fields, and other GUI components for applications.

5. Networking

Python is also widely used for network programming, which involves building applications that
communicate over the internet or local networks.
What is CSV? (Comma-Separated Values)

CSV stands for Comma-Separated Values. It is a simple file format used to store data in a tabular form
(like a spreadsheet) in a text-based file. Each line in a CSV file represents a row of data, and the values
within each row are separated by commas. The format is widely used because it’s easy to read, write, and
share between different applications.

Structure of a CSV File

A CSV file consists of rows and columns:

• Rows: Each row represents a record or data entry. For example, if you're storing information about
students, each row could represent one student.

• Columns: Columns are the fields or attributes of the data. For example, columns in the student data
file might include "Name," "Age," "Grade," etc.

• Comma Separator: The values (data) in each row are separated by commas.

How CSV Files are Used

• Data Storage: CSV files are a simple way to store tabular data without needing complex software.
For example, you can store lists of contacts, sales data, student records, or survey results in CSV
format.

• Data Transfer: Because CSV files are plain text, they are often used to transfer data between
different programs or systems. For example, you might export your contacts from an email program
into a CSV file, or a bank might provide your transaction history in CSV format.

• Data Analysis: CSV files are easy to read and work with in data analysis tools. For instance,
Python, Excel, or other data analysis tools can read CSV files and process the data for analysis, such
as generating graphs, performing calculations, or cleaning up messy data.

• Database Import/Export: Many database management systems allow users to import or export data
in CSV format. If you have a table of data stored in a database, you can export it as a CSV file to
share with others or analyze in a spreadsheet.
ABOUT CREDIT CARD ANALYSIS

A credit card analysis project typically involves studying data related to credit card transactions and
customer behavior to identify trends, detect fraud, or make predictions. Here's a simplified breakdown of the
process:

1. Project Goals:

• Fraud Detection: Identifying suspicious transactions that might be fraudulent.

• Customer Segmentation: Grouping customers based on their spending habits.

• Credit Risk Analysis: Predicting the likelihood that a customer will miss payments.

• Churn Prediction: Finding customers likely to stop using their credit card.

• Spending Patterns: Understanding how and when customers spend money.

2. Data Used:

• Transaction Data: Information on purchases like amounts, locations, and times.

• Customer Data: Basic details like age, income, and credit history.

• Payment History: Data on how and when customers make payments.

3. Data Preprocessing:

• Clean Data: Remove or fix any missing or incorrect data.

• Transform Features: Create new data columns that might be useful, such as total monthly
spending.

• Scale Data: Adjust data to make it easier for machine learning models to work with.

4. Analysis:

• Explore Data: Look for trends or patterns in the data (e.g., spending behavior).

• Visualize Data: Use charts to understand relationships between variables (e.g., spending by age
group).

• Modeling: Use machine learning algorithms to make predictions, like detecting fraud or predicting
customer churn.
5. Model Evaluation:

• Check how well the model is performing using metrics like accuracy or precision.

• Test the Model: Make sure the model works well on new, unseen data.

CSV FILES:

Credit Card Analysis

SOURCE CODE:

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

# Create a synthetic dataset for the initial data


def create_synthetic_data():
np.random.seed(42)
transaction_ids = range(1, 11)
transaction_amounts = np.random.uniform(10, 5000, 10)
categories = ['Groceries', 'Entertainment', 'Utilities', 'Dining', 'Shopping']
transaction_categories = np.random.choice(categories, 10)
df = pd.DataFrame({
'transaction_id': transaction_ids,
'transaction_amount': transaction_amounts,
'category': transaction_categories
})
return df

# Display the DataFrame


def display_data(df):
print("\nCurrent Transaction Data:")
print(df)

# Add a new transaction


def add_data(df):
print("\nAdding a new transaction.")
transaction_id = int(input("Enter transaction ID: "))
transaction_amount = float(input("Enter transaction amount: "))
category = input("Enter category (Groceries, Entertainment, Utilities, Dining, Shopping): ")
new_data = pd.DataFrame({
'transaction_id': [transaction_id],
'transaction_amount': [transaction_amount],
'category': [category]
})
df = pd.concat([df, new_data], ignore_index=True)
print(f"New transaction added: {new_data}")
return df
# Delete a transaction
def delete_data(df):
print("\nDeleting a transaction.")
transaction_id = int(input("Enter the transaction ID to delete: "))
df = df[df['transaction_id'] != transaction_id]
print(f"Transaction with ID {transaction_id} has been deleted.")
return df

# Edit an existing transaction


def edit_data(df):
print("\nEditing a transaction.")
transaction_id = int(input("Enter the transaction ID to edit: "))
if transaction_id in df['transaction_id'].values:
new_amount = float(input("Enter the new transaction amount: "))
new_category = input("Enter the new category (Groceries, Entertainment, Utilities, Dining, Shopping):
")
df.loc[df['transaction_id'] == transaction_id, 'transaction_amount'] = new_amount
df.loc[df['transaction_id'] == transaction_id, 'category'] = new_category
print(f"Transaction with ID {transaction_id} has been updated.")
else:
print(f"Transaction ID {transaction_id} not found.")
return df

# Display charts (transaction amount distribution)


def display_charts(df):
# Plot the distribution of transaction amounts
plt.figure(figsize=(10,6))
plt.hist(df['transaction_amount'], bins=30, color='skyblue', edgecolor='black')
plt.title('Distribution of Transaction Amounts')
plt.xlabel('Amount')
plt.ylabel('Frequency')
plt.show()
# Display spending by category
category_spending = df.groupby('category')['transaction_amount'].sum().sort_values(ascending=False)
category_spending.plot(kind='bar', figsize=(10,6), color='orange')
plt.title('Total Spending by Category')
plt.xlabel('Category')
plt.ylabel('Total Amount')
plt.xticks(rotation=45)
plt.show()

# Main menu
def main():
df = create_synthetic_data()

while True:
print("\n---- Credit Card Transaction Analysis ---- ")
print("1. Display Data")
print("2. Add Data")
print("3. Delete Data")
print("4. Edit Data")
print("5. Display Charts")
print("6. Exit")

choice = input("Enter your choice: ")

if choice == '1':
display_data(df)
elif choice == '2':
df = add_data(df)
elif choice == '3':
df = delete_data(df)
elif choice == '4':
df = edit_data(df)
elif choice == '5':
display_charts(df)
elif choice == '6':
print("Exiting the program.")
break
else:
print("Invalid choice. Please try again.")

if name == " main ":


main()
Output
Conclusion

In simple terms, credit card analysis is about understanding how someone uses their credit card and how it
affects their financial health. It looks at things like how much credit is being used, how often payments are
made on time, and whether the person can manage their debt well.
For banks, it helps decide if they should give someone a credit card. For consumers, it helps them avoid
getting into too much debt and take advantage of rewards or benefits.
Overall, using a credit card wisely—by paying bills on time and not spending more than you can afford—
can help maintain good credit and avoid financial problems.
Bibliography

• INFORMATICS PRACTICES BY SUMITA ARORA(Dhantpat Rai & Co.)(XII)


• INFORMATICS PRACTICES BY PREETI ARORA(SULTANChand)(XII)
• INFORMATICS PRACTICES BY SUMITA ARORA(Dhantpat Rai & Co.)(XI)
• Core Python Programming (Kindle Edition)

You might also like