October 2018
Intermediate to advanced
172 pages
4h 6m
English
The dataset that we are working with contains over 6 million rows of data. Most machine learning algorithms will take a large amount of time to work with a dataset of this size. In order to make our execution time quicker, we will reduce the size of the dataset to 20,000 rows. We can do this by using the following code:
#Storing the fraudulent data into a dataframedf_fraud = df[df['isFraud'] == 1]#Storing the non-fraudulent data into a dataframe df_nofraud = df[df['isFraud'] == 0]#Storing 12,000 rows of non-fraudulent datadf_nofraud = df_nofraud.head(12000)#Joining both datasets together df = pd.concat([df_fraud, df_nofraud], axis = 0)
In the preceding code, the fraudulent rows are stored in one dataframe. This ...
Read now
Unlock full access