Datasets:
step int64 | type string | amount float64 | nameOrig string | oldbalanceOrg float64 | newbalanceOrig float64 | nameDest string | oldbalanceDest float64 | newbalanceDest float64 | isFraud int64 | isFlaggedFraud int64 |
|---|---|---|---|---|---|---|---|---|---|---|
278 | CASH_IN | 330,218.42 | C632336343 | 20,866 | 351,084.42 | C834976624 | 452,419.57 | 122,201.15 | 0 | 0 |
15 | PAYMENT | 11,647.08 | C1264712553 | 30,370 | 18,722.92 | M215391829 | 0 | 0 | 0 | 0 |
10 | CASH_IN | 152,264.21 | C1746846248 | 106,589 | 258,853.21 | C1607284477 | 201,303.01 | 49,038.8 | 0 | 0 |
403 | TRANSFER | 1,551,760.63 | C333676753 | 0 | 0 | C1564353608 | 3,198,359.45 | 4,750,120.08 | 0 | 0 |
206 | CASH_IN | 78,172.3 | C813403091 | 2,921,331.58 | 2,999,503.88 | C1091768874 | 415,821.9 | 337,649.6 | 0 | 0 |
259 | PAYMENT | 915.13 | C2002954533 | 0 | 0 | M290849763 | 0 | 0 | 0 | 0 |
188 | CASH_OUT | 20,603.87 | C813757373 | 0 | 0 | C823291717 | 558,068.66 | 578,672.53 | 0 | 0 |
139 | CASH_OUT | 58,605.72 | C1850864812 | 0 | 0 | C618657299 | 585,494.94 | 644,100.66 | 0 | 0 |
230 | PAYMENT | 4,865.11 | C886849972 | 0 | 0 | M623175144 | 0 | 0 | 0 | 0 |
544 | CASH_OUT | 118,131.63 | C390714641 | 0 | 0 | C366360355 | 8,131,691.35 | 8,476,246.86 | 0 | 0 |
45 | CASH_OUT | 141,100.88 | C1514989792 | 80,506 | 0 | C409578677 | 89,384.09 | 230,484.96 | 0 | 0 |
163 | CASH_OUT | 384,177.48 | C94444270 | 40,348 | 0 | C379896225 | 0 | 384,177.48 | 0 | 0 |
211 | CASH_OUT | 153,486.36 | C513018655 | 20,476 | 0 | C1302281681 | 85,173.16 | 238,659.53 | 0 | 0 |
302 | CASH_OUT | 51,042.59 | C122114408 | 184 | 0 | C705120650 | 380,143.14 | 431,185.74 | 0 | 0 |
18 | PAYMENT | 48,691.16 | C1810046508 | 0 | 0 | M487081598 | 0 | 0 | 0 | 0 |
322 | PAYMENT | 36,598.65 | C1365498607 | 8,240.66 | 0 | M969218364 | 0 | 0 | 0 | 0 |
158 | CASH_OUT | 124,443.29 | C12524561 | 14,236 | 0 | C579157353 | 0 | 124,443.29 | 0 | 0 |
131 | CASH_OUT | 510,190.97 | C1564771551 | 57,590 | 0 | C718731643 | 115,914.88 | 626,105.86 | 0 | 0 |
253 | TRANSFER | 940,927.27 | C1346570604 | 8,568 | 0 | C1178934515 | 0 | 940,927.27 | 0 | 0 |
132 | CASH_OUT | 240,156.34 | C807101143 | 0 | 0 | C1531623971 | 2,811,902.28 | 3,052,058.62 | 0 | 0 |
283 | CASH_OUT | 44,360.26 | C346953986 | 0 | 0 | C526046232 | 282,664.52 | 327,024.78 | 0 | 0 |
43 | CASH_OUT | 338,458.24 | C25552315 | 30,283 | 0 | C75671301 | 1,055,729.15 | 1,564,103.49 | 0 | 0 |
642 | CASH_IN | 311,748.24 | C200195468 | 4,279 | 316,027.24 | C786997986 | 27,843.39 | 0 | 0 | 0 |
164 | DEBIT | 151.58 | C1576094043 | 10,659 | 10,507.42 | C1308477441 | 50,706.33 | 50,857.9 | 0 | 0 |
326 | PAYMENT | 26,565.95 | C1512675672 | 0 | 0 | M1330826048 | 0 | 0 | 0 | 0 |
132 | CASH_OUT | 6.57 | C1286124147 | 0 | 0 | C1885613878 | 2,909,681.35 | 2,909,687.93 | 0 | 0 |
37 | CASH_IN | 23,898.77 | C1953063740 | 50,271 | 74,169.77 | C212080696 | 205,872.37 | 181,973.6 | 0 | 0 |
9 | CASH_OUT | 26,360.78 | C470767940 | 365 | 0 | C598132143 | 202,458.96 | 244,056.68 | 0 | 0 |
157 | CASH_IN | 192,935.2 | C709178804 | 51,937 | 244,872.2 | C1163988187 | 171,874.85 | 0 | 0 | 0 |
406 | TRANSFER | 18,801.43 | C920671013 | 126 | 0 | C1418884586 | 0 | 18,801.43 | 0 | 0 |
235 | PAYMENT | 3,516.08 | C633099116 | 0 | 0 | M2117267163 | 0 | 0 | 0 | 0 |
346 | PAYMENT | 6,987.8 | C220437223 | 0 | 0 | M1751641542 | 0 | 0 | 0 | 0 |
19 | CASH_IN | 8,808.73 | C1717919401 | 50,485 | 59,293.73 | C645140627 | 177,448.43 | 168,639.7 | 0 | 0 |
208 | PAYMENT | 24,649.07 | C1353964860 | 0 | 0 | M1059671726 | 0 | 0 | 0 | 0 |
332 | CASH_OUT | 97,562.73 | C1894828300 | 5,396 | 0 | C1975390043 | 2,455,585.33 | 2,553,148.05 | 0 | 0 |
139 | TRANSFER | 598,680.17 | C544409289 | 45,059 | 0 | C956338890 | 2,559,233 | 3,157,913.17 | 0 | 0 |
304 | CASH_OUT | 218,659.82 | C88319926 | 1,005 | 0 | C1971781194 | 16,320,325.66 | 16,592,681.56 | 0 | 0 |
686 | CASH_IN | 304,408.97 | C893917810 | 4,276,845.77 | 4,581,254.74 | C1327824794 | 1,443,186.93 | 1,314,479.93 | 0 | 0 |
139 | PAYMENT | 5,090.28 | C1405934398 | 50,617 | 45,526.72 | M839389189 | 0 | 0 | 0 | 0 |
226 | CASH_OUT | 176,016.04 | C800760258 | 0 | 0 | C358043414 | 12,916,654.7 | 13,005,481.5 | 0 | 0 |
201 | PAYMENT | 11,605.7 | C484951468 | 0 | 0 | M1504624467 | 0 | 0 | 0 | 0 |
14 | CASH_IN | 234,850.43 | C982073663 | 669,990.79 | 904,841.22 | C1216254870 | 298,639.42 | 49,936.17 | 0 | 0 |
323 | CASH_OUT | 186,549.79 | C1647129298 | 0 | 0 | C1714837024 | 242,473.16 | 429,022.95 | 0 | 0 |
225 | CASH_OUT | 79,042.15 | C2086229320 | 6,064 | 0 | C1654662784 | 410,360.71 | 489,402.86 | 0 | 0 |
138 | PAYMENT | 5,055.72 | C315487150 | 108,809.83 | 103,754.11 | M1717055694 | 0 | 0 | 0 | 0 |
41 | PAYMENT | 12,020.77 | C1235787929 | 639,020.83 | 627,000.06 | M1043686153 | 0 | 0 | 0 | 0 |
399 | CASH_IN | 123,326.84 | C979213321 | 5,477,362 | 5,600,688.84 | C787242927 | 3,470,716.16 | 3,347,389.32 | 0 | 0 |
120 | PAYMENT | 14,241.21 | C1653380908 | 109,207 | 94,965.79 | M77882578 | 0 | 0 | 0 | 0 |
373 | PAYMENT | 23,480.16 | C1099535493 | 5,309 | 0 | M933507080 | 0 | 0 | 0 | 0 |
179 | CASH_IN | 195,205.19 | C2147063789 | 1,961,856.75 | 2,157,061.94 | C1021587874 | 1,150,566.93 | 955,361.74 | 0 | 0 |
544 | CASH_OUT | 145,319.54 | C237037918 | 8,056 | 0 | C95318372 | 696,100.99 | 841,420.53 | 0 | 0 |
369 | PAYMENT | 14,270.03 | C1496903190 | 3,309 | 0 | M946866772 | 0 | 0 | 0 | 0 |
275 | PAYMENT | 6,851.17 | C1051106607 | 0 | 0 | M1348761534 | 0 | 0 | 0 | 0 |
396 | CASH_IN | 296,959.67 | C731717743 | 10,609 | 307,568.67 | C148906605 | 0 | 0 | 0 | 0 |
304 | CASH_IN | 166,630.9 | C1410677661 | 10,944 | 177,574.9 | C704312950 | 240,525 | 73,894.11 | 0 | 0 |
162 | CASH_IN | 165,135.41 | C677811242 | 187,326.54 | 352,461.95 | C788874634 | 190,273.97 | 25,138.56 | 0 | 0 |
304 | PAYMENT | 1,704.03 | C74556831 | 0 | 0 | M1951402325 | 0 | 0 | 0 | 0 |
22 | CASH_IN | 390,903.09 | C41573174 | 7,947,520.93 | 8,338,424.03 | C860929789 | 707,650.38 | 316,747.29 | 0 | 0 |
229 | PAYMENT | 21,061.24 | C40966245 | 0 | 0 | M1653653617 | 0 | 0 | 0 | 0 |
259 | PAYMENT | 8,129.46 | C40866646 | 0 | 0 | M182944108 | 0 | 0 | 0 | 0 |
234 | PAYMENT | 6,492.32 | C1321671140 | 252,978.2 | 246,485.88 | M533921438 | 0 | 0 | 0 | 0 |
304 | CASH_OUT | 16,242.22 | C1322294401 | 0 | 0 | C160609026 | 1,401,840.75 | 1,418,082.97 | 0 | 0 |
352 | CASH_OUT | 286,864.49 | C998029122 | 0 | 0 | C1563899518 | 598,674.63 | 885,539.12 | 0 | 0 |
139 | CASH_IN | 147,351.57 | C710908433 | 6,185,044.14 | 6,332,395.71 | C508488713 | 7,292,368.53 | 7,145,016.96 | 0 | 0 |
229 | TRANSFER | 21,362.19 | C1977482177 | 0 | 0 | C1554823726 | 102,800.19 | 124,162.37 | 0 | 0 |
186 | PAYMENT | 16,871.75 | C1345262134 | 374,693.53 | 357,821.78 | M1183610480 | 0 | 0 | 0 | 0 |
406 | CASH_OUT | 88,826.43 | C952906355 | 249,733 | 160,906.57 | C1084012188 | 963,113.59 | 1,051,940.02 | 0 | 0 |
469 | PAYMENT | 38,509.2 | C174212239 | 0 | 0 | M1265795703 | 0 | 0 | 0 | 0 |
399 | PAYMENT | 7,301.4 | C239144018 | 21,426 | 14,124.6 | M1684201690 | 0 | 0 | 0 | 0 |
288 | PAYMENT | 51,907.16 | C1577059714 | 48,529 | 0 | M1955312313 | 0 | 0 | 0 | 0 |
204 | PAYMENT | 343.06 | C1370498771 | 0 | 0 | M301320628 | 0 | 0 | 0 | 0 |
232 | CASH_OUT | 24,413.46 | C1542135254 | 5,088 | 0 | C1938475526 | 0 | 24,413.46 | 0 | 0 |
192 | CASH_OUT | 125,568.72 | C923977418 | 55,360 | 0 | C779506402 | 0 | 125,568.72 | 0 | 0 |
13 | CASH_OUT | 203,321.66 | C1009192782 | 7,707.02 | 0 | C1015529677 | 223,460.41 | 426,782.08 | 0 | 0 |
281 | PAYMENT | 7,452.27 | C1418729422 | 254,793 | 247,340.73 | M1996394103 | 0 | 0 | 0 | 0 |
379 | CASH_IN | 117,253.94 | C2029840344 | 1,527,903.53 | 1,645,157.47 | C2142547587 | 309,923.06 | 192,669.12 | 0 | 0 |
159 | CASH_OUT | 16,500.28 | C731563967 | 0 | 0 | C914957636 | 1,039,511.46 | 1,056,011.74 | 0 | 0 |
324 | PAYMENT | 25,380.11 | C1515172243 | 0 | 0 | M849428673 | 0 | 0 | 0 | 0 |
230 | CASH_OUT | 95,623.45 | C1025174837 | 95,785 | 161.55 | C1337597412 | 0 | 95,623.45 | 0 | 0 |
405 | CASH_IN | 122,899.15 | C1358412469 | 6,017 | 128,916.15 | C1995332832 | 227,088.65 | 104,189.5 | 0 | 0 |
380 | CASH_IN | 255,661.72 | C1144246806 | 1,148,679.19 | 1,404,340.91 | C87426661 | 1,991,419.36 | 1,735,757.64 | 0 | 0 |
307 | CASH_OUT | 124,210.26 | C583984242 | 13,648 | 0 | C408688303 | 637,289.41 | 761,499.67 | 0 | 0 |
43 | TRANSFER | 406,390.63 | C449334349 | 0 | 0 | C1477190619 | 596,285.7 | 1,002,676.33 | 0 | 0 |
404 | CASH_IN | 12,747.45 | C1946500289 | 3,027,551.36 | 3,040,298.81 | C748382555 | 193,795.69 | 181,048.24 | 0 | 0 |
36 | PAYMENT | 17,210.24 | C2035379457 | 468,747.37 | 451,537.13 | M1250735899 | 0 | 0 | 0 | 0 |
401 | CASH_IN | 287,548.26 | C2147246002 | 6,300,194.15 | 6,587,742.41 | C1034690288 | 1,211,290.25 | 923,741.99 | 0 | 0 |
259 | CASH_IN | 326,712.9 | C1906310517 | 10,763,635.06 | 11,090,347.96 | C809795627 | 2,415,359.64 | 2,088,646.74 | 0 | 0 |
228 | PAYMENT | 241.89 | C1249789290 | 103,317.6 | 103,075.72 | M870078784 | 0 | 0 | 0 | 0 |
236 | PAYMENT | 5,883.37 | C1938448095 | 0 | 0 | M1022031461 | 0 | 0 | 0 | 0 |
297 | PAYMENT | 13,055.28 | C508385511 | 0 | 0 | M956027336 | 0 | 0 | 0 | 0 |
12 | PAYMENT | 616.88 | C1013341637 | 107,243.5 | 106,626.62 | M1942028884 | 0 | 0 | 0 | 0 |
236 | CASH_OUT | 107,759.5 | C1408936980 | 0 | 0 | C1403087041 | 1,507,711.83 | 1,615,471.33 | 0 | 0 |
253 | CASH_IN | 18,868.29 | C1363041822 | 21,137,221.01 | 21,156,089.3 | C1761313958 | 34,831.61 | 15,963.32 | 0 | 0 |
13 | PAYMENT | 4,986.63 | C1359889730 | 0 | 0 | M1124177815 | 0 | 0 | 0 | 0 |
36 | PAYMENT | 17,692.64 | C1270549119 | 10,268 | 0 | M743266449 | 0 | 0 | 0 | 0 |
403 | PAYMENT | 7,457.89 | C2051931889 | 0 | 0 | M2079068430 | 0 | 0 | 0 | 0 |
300 | DEBIT | 2,262.52 | C841098437 | 49,271 | 47,008.48 | C1097907228 | 124,780 | 127,042.52 | 0 | 0 |
564 | CASH_IN | 67,418.91 | C1484852473 | 52,181 | 119,599.91 | C170358894 | 1,659,195.46 | 1,591,776.55 | 0 | 0 |
254 | PAYMENT | 9,414.76 | C2023654274 | 5,839.9 | 0 | M210283336 | 0 | 0 | 0 | 0 |
206 | PAYMENT | 17,485.51 | C928494081 | 9,339 | 0 | M981647331 | 0 | 0 | 0 | 0 |
PaySim Financial Fraud Detection — EDA & Dataset Analysis
Presentation Video
Dataset Overview
This project analyzes the PaySim Financial Fraud Detection dataset from Kaggle (source: chitwanmanchanda/fraudulent-transactions-data). The dataset contains simulated mobile money transactions with fraud labels, representing 100,000 randomly sampled transactions (random_state=42) from the original 6,362,620 rows.
Key characteristics:
- Total records: 100,000 transactions
- Target variable:
isFraud(0 = legitimate, 1 = fraudulent) - Data quality issues found & resolved: 200 missing
amountvalues, 300 missingoldbalanceOrgvalues, 500 duplicate rows, 400 inconsistenttypeformatting - Class imbalance: Fraud is extremely rare (~0.14% of all transactions)
Research Question
"How do specific economic indicators, such as transaction types and sudden inconsistencies between account balances, act as financial fingerprints to accurately predict fraudulent activity, and can identifying these logical gaps in the data lead to more efficient and cost-effective detection systems?"
This project investigates whether patterns in transaction characteristics—particularly transaction type, amount magnitude, and account balance behavior—can serve as reliable fraud indicators without relying on demographic or user-level features.
Features
| Feature | Type | Description |
|---|---|---|
step |
int | Time step of the transaction (1-743, representing hours in simulation) |
type |
str | Transaction type: CASH_IN, CASH_OUT, DEBIT, PAYMENT, TRANSFER |
amount |
float | Transaction amount (in currency units) |
oldbalanceOrg |
float | Original account balance before transaction |
newbalanceOrig |
float | Original account balance after transaction |
oldbalanceDest |
float | Destination account balance before transaction |
newbalanceDest |
float | Destination account balance after transaction |
isFraud |
int | Binary fraud label (0 = legitimate, 1 = fraudulent) |
isFlaggedFraud |
int | Whether transaction was flagged by bank's system |
amount_log |
float | Log-transformed amount (log1p) for analysis |
EDA Methodology
1. Data Loading & Cleaning
Issues introduced to simulate real-world financial data quality problems:
- 200 missing values in
amount(simulating incomplete transaction records) - 300 missing values in
oldbalanceOrg(simulating balance data not captured at logging time) - 500 duplicate rows (simulating double-logging errors in the payment system)
- 400 rows with inconsistent casing in
type(simulating data entry errors)
Cleaning steps applied:
- Missing
amount→ dropped rows: A transaction with no amount is unusable and cannot be safely imputed - Missing
oldbalanceOrg→ filled with median: Median chosen over mean because the amount column is right-skewed; median is a robust estimator - Duplicates →
drop_duplicates(): Removed all 500 duplicate rows to prevent inflated counts typeinconsistency →.str.upper().str.strip(): Standardized all 5 transaction types to uppercase to preventtransferandTRANSFERbeing treated as separate categories
2. Outlier Detection & Treatment
Applied Interquartile Range (IQR) method on amount feature. 5,358 outliers detected (5.4% of data). Decision: retained all outliers because fraud transactions often occur at extreme values.
Applied log1p transformation to amount → amount_log for cleaner visualization.
3. Descriptive Statistics
Calculated summary statistics by fraud status. Key insight: fraud transactions are drastically larger than legitimate ones — average fraud amount ~1,340,000 vs. legitimate ~179,000 (ratio: 7.5x larger).
4. Correlation Analysis
Generated correlation heatmap of all numerical features to identify relationships between balance features and fraud status.
5. Transaction Type Distribution
Visualized how transactions are distributed across all 5 types.
6. Fraud by Transaction Type (Raw Count)
Showed where fraud actually occurs across transaction types before normalizing for volume.
Key Findings
Overall Fraud Characteristics
- Fraud rate: 0.14% of all transactions (142 fraudulent out of 100,000)
- Class imbalance: Highly skewed toward legitimate transactions
- Amount severity: Fraudulent transactions are 7.5x larger on average
- Bank's detection: Only 0.56% of fraudulent transactions flagged (isFlaggedFraud=1)
Transaction Type Distribution
- Most common type: TRANSFER (35%)
- PAYMENT transactions: 31%
- CASH_OUT: 24%
- DEBIT: 8%
- CASH_IN: 2%
Fraud Distribution by Type
- TRANSFER: 0.99% fraud rate (77 frauds out of 7,806 transfers)
- CASH_OUT: 0.30% fraud rate (65 frauds out of 23,235 cash-outs)
- PAYMENT: 0% fraud rate (0 frauds)
- DEBIT: 0% fraud rate (0 frauds)
- CASH_IN: 0% fraud rate (0 frauds)
Four Research Questions & Insights
Research Q1: "Do high-value transactions carry higher fraud risk?"
Finding: Yes, fraud transactions occupy the extreme upper tail of the amount distribution. The highest-value transactions show disproportionately high fraud rates, indicating that transaction magnitude is a critical risk indicator.
Conclusion: Amount is a strong univariate fraud signal. Fraudsters tend to target high-value transfers to maximize stolen funds per transaction.
Research Q2: "Do fraudsters drain the sender's account to zero?"
Finding:
- Fraudsters drain the sender account to zero in ~96% of fraud cases
- Legitimate transactions show account depletion in only ~0.3% of cases
- This is a massive logical inconsistency: legitimate users rarely empty accounts, but fraudsters consistently do
Conclusion: Balance depletion is one of the strongest fraud indicators in the dataset. This "emptying the well" behavior is a logical fingerprint of fraudulent activity — attackers maximize extraction and disappear.
Research Q3: "Are certain transaction types fraud-free?"
Finding:
- TRANSFER and CASH_OUT are the only types with any fraud (0.99% and 0.30% respectively)
- PAYMENT, DEBIT, and CASH_IN have a 0% fraud rate in this dataset
- Fraud is concentrated in transaction types that move money away from the original account
Conclusion: Transaction type is a critical categorical predictor. A simple rule-based filter (flag TRANSFER & CASH_OUT only) would catch 100% of fraud with minimal false positives.
Research Q4: "Is fraud correlated with transaction amount ranges?"
Finding:
- Small (<1K): ~0.04% fraud rate
- Medium (1K–10K): ~0.10% fraud rate
- Large (10K–100K): ~0.27% fraud rate
- Very Large (>100K): ~1.08% fraud rate
- Clear monotonic increase: Larger amount buckets have exponentially higher fraud risk
Conclusion: Amount binning creates a simple but effective fraud scoring feature. The largest transactions contain ~8x more fraud than the smallest, making amount a strong standalone predictor.
Key Decisions & Rationale
Why keep outliers?
Fraud is inherently an outlier behavior. Removing high-value transactions would eliminate the most suspicious cases. Decision: Retain all 5,358 outliers because they represent the exact transactions we want to catch.
Why log-transform the amount?
Raw amounts span from 0 to millions, creating extreme skewness. Log transformation makes distributions more interpretable, reduces visual dominance of extreme values, and improves visualization clarity without losing information.
Why 100K sample?
The original dataset has 6.3M rows. A 100K random sample maintains the representative fraud rate (~0.14%), reduces computational overhead, and is sufficient for EDA. Reproducibility is ensured with seed=42.
Why focus on these 4 research questions?
Each addresses a different dimension of fraud detection logic — amount risk, balance consistency, transaction-type filtering, and amount-bin stratification. Together they reveal that fraud has multiple independent signals that all point in the same direction.
Conclusion
This EDA reveals that financial fraud leaves multiple consistent fingerprints in transaction data. Rather than relying on complex models or external features, we can identify fraud through transaction type filtering (TRANSFER & CASH_OUT only), amount thresholds (very large transactions are far more likely to be fraud), and balance logic checks (account depletion to zero is virtually diagnostic).
These insights suggest that cost-effective fraud detection is possible through simple rule-based systems with high precision, tiered monitoring for high-risk transaction types, and real-time balance anomaly detection. Future work could focus on ensemble methods combining these signals, time-series analysis, and network-level features to achieve even higher detection rates.
Dataset source: Kaggle — PaySim Financial Fraud Detection
Sample method: Random sampling, n=100,000, random_state=42
Analysis date: April 2026
This project was created for educational purposes only and is submitted as part of a Data Science course assignment at Reichman University.
- Downloads last month
- 99








