<jupyter_start><jupyter_text>1.	How have the number of accidents fluctuated over the past year and a half? Have they increased over the time?<jupyter_code>#DATE to datetime format
df["fecha_incidente"] = pd.to_datetime(df["fecha_incidente"])
#prueba = prueba.index.to_period("M")
df["PERIOD"] = df["fecha_incidente"].dt.to_period('M')
#Create WeekDay
df["WEEKDAY"] = df.fecha_incidente.dt.weekday

df = df.set_index('fecha_incidente')
#How have the number of accidents fluctuated over the past two years? Have the increase over the time?
#Line Plot - Last two years.
fig, ax = plt.subplots(figsize=(20,5))
df.loc['2014-01-01':'2019-09-30'].groupby("PERIOD")["radicado"].count().plot(ax=ax)<jupyter_output><empty_output><jupyter_text>2.	For any particular day, during which hours are accidents most likely to occur?<jupyter_code>%%time
x=df['hora_incidente'].value_counts(dropna=True)
HourlyCount=plt.figure(figsize=(20,5))
ax = HourlyCount.add_subplot(111)
plt.bar(x.index, x.values)
plt.xticks(x.index)
plt.title("Hourly accident count in Medellin")
plt.show()
x.values<jupyter_output><empty_output><jupyter_text>Accidents are most likely to occur in the afternoon. 3.	Are there more accidents on weekdays than weekends?3.	Are there more accidents on weekdays than weekends?<jupyter_code># Los nombres de los días son strings con 9 caracteres
df['dia_nombre']=df['dia_nombre'].apply(lambda x: x.replace(' ', ''))
%%time
x=df['dia_nombre'].value_counts()
OrderedDays = ['LUNES', 'MARTES', 'MIÉRCOLES', 'JUEVES', 'VIERNES', 'SÁBADO', 'DOMINGO']
AccidentCount = [x[i] for i in OrderedDays]
DayOfWeekCount=plt.figure(figsize=(20,5))
ax = DayOfWeekCount.add_subplot(111)
plt.bar(OrderedDays, AccidentCount)
plt.xticks(x.index)
plt.title("Accident count by day of the week in Medellin")
for i in ax.patches:
    ax.text(i.get_x()+0.3, i.get_height()+30, i.get_height())
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14698162729658792, 'fraction_numerical': 0.02099737532808399, 'mean_word_length': 7.042194092827004, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '499816', 'license': 'CC-BY-4.0', 'n_tokens_mistral': 757, 'n_tokens_neox': 718, 'n_words': 167, 'path': 'backend/src/playground/MJ/EDA_E1_3.ipynb', 'repo_name': 'daniel6omez/ds4a-practicum', 'size': '1905'}