text_html_output_1.png
import matplotlib.pyplot as plt

import os

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

import seaborn as sns

import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
pd.options.mode.chained_assignment = None
import os

crime = pd.read_csv('/kaggle/input/los-angeles-crime-arrest-data/crime-data-from-2010-to-present.csv')
arrest = pd.read_csv('/kaggle/input/los-angeles-crime-arrest-data/arrest-data-from-2010-to-present.csv')

ocrd = [list(), list(), list()]
rprt = [list(), list(), list()]
datas = [list(crime['Date Occurred']), list(crime['Date Reported'])]
lists = [ocrd, rprt]
x = 0
while x < 2:
    for i in datas[x]:
        temp = i.split('-')
        if len(str(temp[0])) == 7:
            lists[x][0].append(str(temp[0])[3:8])
        else:
            lists[x][0].append(temp[0])
        lists[x][1].append(str(temp[1]))
        lists[x][2].append(str(temp[2])[0:2])
    x += 1

dist = crime['Area Name'].unique()
rate = []
for i in dist:
    x = len(crime.loc[crime['Area Name'] == i])
    rate.append(x)
rate.sort(reverse=True)

f, ax = plt.subplots(figsize=(15, 8))
sns.barplot(x=dist, y=rate)
plt.xticks(rotation=45)
plt.xlabel = 'Area'
plt.ylabel = 'Count'
plt.show()