# Exploratory Data Analysis Traffic Accidents in Georgia

I recently obtained access to a large dataset for traffic accidents in the state of Georgia for a school project and I thought it would be fun to do some exploratory data analysis and to visualize the data using python.

The file comes from Georgia Department of Transportation and it ranges from 2006to 2016. For this exercise I will just focus on the month of October in year 2016.

``````import folium
from folium.plugins import MarkerCluster
from folium.plugins import HeatMap
import pandas as pd

data1 = data1[data1["month"] == 10]
lats = list(data1["Latitude"])
longs = list(data1["Longitude"])
``````

First I will make a map with Folium to show all the how many accidents happened in a certain area. The best way is to show just a cluster of data points using the MarkerCluster function:

``````map = folium.Map(location=[33.75, -84.39], zoom_start=10, tiles="OpenStreetMap")
for lt, ln in zip(lats, longs):
map.save("Map1.html")``````

Below is a snapshot of the map

Now, a better way to visualize the number of accidents on a map is to display a heatmap. We can utilize the built-in heatmap function from Folium to achieve this.

``````data1["Latitude"] = data1["Latitude"].astype(float)
data1["Longitude"] = data1["Longitude"].astype(float)
heatDF = data1[["Latitude", "Longitude"]]

heatmap = folium.Map(location=[33.75, -84.39], zoom_start=10, tiles="OpenStreetMap")
heatdata = [[row["Latitude"], row["Longitude"]] for index, row in heatDF.iterrows()] 