import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
nyc_counties = ['Bronx County','Kings County','New York County','Queens County','Richmond County']
datasets = ['dtxe.br0.csv','dtxe.br1.csv','dtxe.br2.csv','dtxe.br3.csv','dtxe.br4.csv',
'dtxe.totalcrime.csv','dtxe.propertycrime.csv','dtxe.violentcrime.csv',
'dtxe.employment.csv','dtxe.salary.csv']
def dtxe(file):
df = pd.read_csv(file)
df = df.T
df.rename(columns = df.iloc[0], inplace = True)
df.drop(df.index[0], inplace = True)
df = df.loc[:,['Bronx County','Kings County','New York County','Queens County','Richmond County']]
return df
file = 'dtxe.salary.csv'
df = dtxe(file)
plt.plot(df)
plt.title('Salary Growth')
plt.xlabel('Year',fontsize = 20)
plt.ylabel('Salary ($)',fontsize = 18)
plt.legend(['Bronx County','Kings County','New York County','Queens County','Richmond County'])
plt.rcParams['figure.figsize'] = [10, 6]
plt.grid(True)
plt.show()
file = 'dtxe.employment.csv'
df = dtxe(file)
plt.plot(df)
plt.title('Cumulative Employment')
plt.xlabel('Year',fontsize = 20)
plt.ylabel('Employed Persons (1e6)',fontsize = 18)
plt.legend(['Bronx County','Kings County','New York County','Queens County','Richmond County'], loc = 'center left')
plt.rcParams['figure.figsize'] = [10, 6]
plt.grid(True)
plt.show()
file = 'dtxe.totalcrime.csv'
df = dtxe(file)
plt.plot(df)
plt.title('Total Crime')
plt.xlabel('Year',fontsize = 20)
plt.ylabel('Number of Incidents',fontsize = 18)
plt.legend(['Bronx County','Kings County','New York County','Queens County','Richmond County'], loc = 'lower left')
plt.rcParams['figure.figsize'] = [10, 6]
plt.grid(True)
plt.show()
file = 'dtxe.violentcrime.csv'
df = dtxe(file)
plt.plot(df)
plt.title('Violent Crime')
plt.xlabel('Year',fontsize = 20)
plt.ylabel('Number of Incidents',fontsize = 18)
plt.legend(['Bronx County','Kings County','New York County','Queens County','Richmond County'], loc = 'lower left')
plt.rcParams['figure.figsize'] = [10, 6]
plt.grid(True)
plt.show()
file = 'dtxe.propertycrime.csv'
df = dtxe(file)
plt.plot(df)
plt.title('Property Crime')
plt.xlabel('Year',fontsize = 20)
plt.ylabel('Number of Incidents',fontsize = 18)
plt.legend(['Bronx County','Kings County','New York County','Queens County','Richmond County'], loc = 'lower left')
plt.rcParams['figure.figsize'] = [10, 6]
plt.grid(True)
plt.show()