In [1]:
import pandas
In [2]:
df = pandas.read_csv("./Cluster-Crime-Janeiro.csv")
In [4]:
de = df['NATUREZA DA OCORRÊNCIA'].groupby(df['CLUSTER']).describe()
In [5]:
df['NATUREZA DA OCORRÊNCIA'].describe()
Out[5]:
In [6]:
de
Out[6]:
In [7]:
new_df = df.groupby('CLUSTER')
In [8]:
crimes = new_df['NATUREZA DA OCORRÊNCIA'].count()
In [9]:
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.ticker as ticker
In [12]:
crimes.plot(kind='barh', figsize=(10,8), color='#cc0000')
plt.title('Crimes Number (Jan 2017)')
plt.xlabel('Number')
plt.ylabel('Cluster - Região')
plt.tight_layout()
ax = plt.gca()
ax.xaxis.set_major_formatter(ticker.StrMethodFormatter('{x:,.0f}'))
plt.show()
In [10]:
Out[10]:
In [ ]: