text_plain_output_1.png
import matplotlib.pyplot as plt

import numpy as np # linear algebra

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import seaborn as sns

train_identity_data = pd.read_csv('../input/train_identity.csv')
train_transaction_data = pd.read_csv('../input/train_transaction.csv')
test_identity_data = pd.read_csv('../input/test_identity.csv')
test_transaction_data = pd.read_csv('../input/test_transaction.csv')

import seaborn as sns
import matplotlib.pyplot as plt

cardTypes = ['discover', 'mastercard', 'visa', 'american express']
for i, i_card in enumerate(cardTypes):
    cardData = eval('train_transaction_data.loc[train_transaction_data["card4"]=="' + i_card + '"]')

normalDataTransaction = train_transaction_data.loc[train_transaction_data['isFraud'] == 0]

fraudDataTransaction = train_transaction_data.loc[train_transaction_data['isFraud'] == 1]

prodTypes = train_transaction_data['ProductCD'].unique()
for i, i_prod in enumerate(prodTypes):
    productData = eval('train_transaction_data.loc[train_transaction_data["ProductCD"]=="' + i_prod + '"]')
    plt.figure(i)
    ax = sns.barplot(x='isFraud', y='isFraud', data=productData, estimator=lambda x: len(x) / len(productData) * 100)
    ax.set(ylabel='Percent')
    ax.set_title(i_prod)