This project analyzes a financial transactions dataset to identify fraud patterns using Python. The focus is on data exploration, data quality checks, transaction behavior, fraud distribution, and simple business insights.
The goal is not to build a complex machine learning model. Instead, this project is designed to demonstrate a clear beginner-to-intermediate data analysis workflow using pandas and basic visualizations.
The original dataset contains online financial transactions with the following fields:
step: Time step of the transactiontype: Transaction typeamount: Transaction amountnameOrig: Origin accountoldbalanceOrg: Origin account balance before the transactionnewbalanceOrig: Origin account balance after the transactionnameDest: Destination accountoldbalanceDest: Destination account balance before the transactionnewbalanceDest: Destination account balance after the transactionisFraud: Fraud label where1 = fraudand0 = not fraudisFlaggedFraud: System flag for potentially fraudulent transactions
The full dataset has 6,362,620 transactions and 11 columns.
Note: The full CSV file is too large for a standard GitHub upload. This repository includes a smaller sample dataset for demonstration purposes.
- Python
- pandas
- matplotlib
- Jupyter Notebook
This analysis answers the following questions:
- How many transactions are included in the dataset?
- What percentage of transactions are fraudulent?
- Which transaction types are most common?
- Which transaction types are most associated with fraud?
- What is the total and average amount involved in fraudulent transactions?
- How do transaction amounts differ between fraud and non-fraud transactions?
- How does fraud activity change over time?
- How often does the system flag transactions that are actually fraudulent?
- Are there missing values that should be reviewed before deeper analysis?
- The full dataset contains 6,362,620 transactions.
- There are 8,213 fraudulent transactions, which represents approximately 0.13% of all transactions.
- Fraud is highly imbalanced, meaning non-fraud transactions are much more common than fraud transactions.
- Fraud appears only in
TRANSFERandCASH_OUTtransaction types in this dataset. - The total amount involved in fraudulent transactions is approximately $12.06B.
- The average fraudulent transaction amount is approximately $1.47M.
- Only 16 transactions were flagged by the system as fraud, while the dataset contains 8,213 actual fraud cases.
- No missing values were found in the main dataset fields.
Fraud-Detection-Python-Analysis/
├── README.md
├── data/
│ └── fraud_transactions_sample.csv
└── notebooks/
└── Fraud_Detection_EDA.ipynb
- Reading and inspecting CSV data with pandas
- Checking dataset shape, columns, data types, and missing values
- Calculating fraud rate and fraud transaction totals
- Grouping data by transaction type
- Comparing fraud and non-fraud transactions
- Creating basic visualizations with matplotlib
- Communicating findings in a business-friendly way
This project is intentionally focused on exploratory data analysis rather than advanced machine learning. A machine learning model could be added later once the exploratory analysis is stronger and the class imbalance problem is handled properly.