image_output_1.png
import matplotlib.pyplot as plt

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

data = pd.read_csv('../input/database.csv', low_memory=False)

f, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2, figsize=(13, 15))

crims_by_relationship = data[['Relationship', 'Record ID']].groupby('Relationship').count()
crimes_per_perpetrator_race = data[['Perpetrator Race', 'Record ID']].groupby('Perpetrator Race').count()
crimes_per_victime_race = data[['Victim Race', 'Record ID']].groupby('Victim Race').count()
crimes_per_type = data[['Crime Type', 'Record ID']].groupby('Crime Type').count()

crimes_per_perpetrator_race.plot(kind='bar', ax= ax1, title='crimes per perpetrator race')
crimes_per_victime_race.plot(kind='bar', ax= ax2, title='crimes per victime race')
crims_by_relationship.plot(kind='bar', ax= ax3, title='crimes by relationship')
crimes_per_type.plot(kind='bar', ax= ax4, title='crimes types')

data1 = data[['Relationship', 'Year', 'Record ID']].groupby(['Relationship', 'Year']).count().reset_index()
plt.plot(data1[data1.Relationship == 'Wife']['Year'].tolist(), data1[data1.Relationship == 'Wife']['Record ID'].tolist(), data1[data1.Relationship == 'Acquaintance']['Year'].tolist(), data1[data1.Relationship == 'Acquaintance']['Record ID'].tolist())
plt.show()