Skip to main content

Posts

Showing posts from January, 2022

Credit Card Fraud Detection project

Before going to the code it is requested to work on a jupyter notebook. If not installed on your machine you can use  Google colab . You can download the dataset from  this link If the link is not working please go to  this  link and log in to kaggle to download the dataset.  Importing all the necessary Libraries # import the necessary packages import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from matplotlib import gridspec Loading the Dataset # Load the dataset from the csv file using pandas # best way is to mount the drive on colab and # copy the path for the csv file data = pd.read_csv( "credit.csv" ) Understanding the dataset # Grab a peek at the data data.head() Describing the Data # Print the shape of the data # data = data.sample(frac = 0.1, random_state = 48) print (data.shape) print (data.describe()) Imbalance in the data # Determine number of fraud cases in dataset fraud = data[data[ 'Class' ] = = 1 ] vali