{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Traffic collisions in Los Angeles County\n", "\n", "This is a Jupyter Notebook for analyzing the traffic collision data available for Los Angeles County through TIMS. The analysis uses the Pandas package in Python:\n" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import pandas" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Analyzing data\n", "\n", "Here I will analyze data about traffic collisions in Los Angeles County. First, let's load the data set into pandas and take a look at it. This particular data set is for the collisions which occurred in Los Angeles County in January 2012." ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "(4146, 83)" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#Load the data, show data size\n", "\n", "data = pandas.read_csv('Jan12Collisions.csv')\n", "data.shape" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This means there are 4146 collisions recorded (instances) and 83 observations (features) for each collision." ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
\n", " | CASEID | \n", "POINT_X | \n", "POINT_Y | \n", "YEAR_ | \n", "LOCATION | \n", "CHPTYPE | \n", "DAYWEEK | \n", "CRASHSEV | \n", "VIOLCAT | \n", "KILLED | \n", "... | \n", "BICINJ | \n", "MCKILL | \n", "MCINJURE | \n", "RAMP1 | \n", "RAMP2 | \n", "CITY | \n", "COUNTY | \n", "STATE | \n", "X_CHP | \n", "Y_CHP | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "6413841 | \n", "0.000000 | \n", "0.000000 | \n", "2012 | \n", "1942 | \n", "0 | \n", "2 | \n", "3 | \n", "09 | \n", "0 | \n", "... | \n", "0 | \n", "0 | \n", "0 | \n", "- | \n", "- | \n", "LOS ANGELES | \n", "LOS ANGELES | \n", "CA | \n", "0.00000 | \n", "0.00000 | \n", "
1 | \n", "6348475 | \n", "-118.208609 | \n", "33.873498 | \n", "2012 | \n", "1900 | \n", "3 | \n", "1 | \n", "4 | \n", "03 | \n", "0 | \n", "... | \n", "0 | \n", "0 | \n", "0 | \n", "- | \n", "- | \n", "UNINCORPORATED | \n", "LOS ANGELES | \n", "CA | \n", "-118.20821 | \n", "33.87339 | \n", "
2 | \n", "6216712 | \n", "-118.210569 | \n", "33.925397 | \n", "2012 | \n", "1943 | \n", "1 | \n", "4 | \n", "4 | \n", "03 | \n", "0 | \n", "... | \n", "0 | \n", "0 | \n", "0 | \n", "- | \n", "- | \n", "LYNWOOD | \n", "LOS ANGELES | \n", "CA | \n", "-118.21148 | \n", "33.92575 | \n", "
3 | \n", "6071228 | \n", "-118.536040 | \n", "34.168913 | \n", "2012 | \n", "1942 | \n", "0 | \n", "5 | \n", "4 | \n", "00 | \n", "0 | \n", "... | \n", "0 | \n", "0 | \n", "0 | \n", "- | \n", "- | \n", "LOS ANGELES | \n", "LOS ANGELES | \n", "CA | \n", "0.00000 | \n", "0.00000 | \n", "
4 | \n", "6063954 | \n", "-118.168333 | \n", "34.114790 | \n", "2012 | \n", "1970 | \n", "0 | \n", "4 | \n", "4 | \n", "18 | \n", "0 | \n", "... | \n", "1 | \n", "0 | \n", "0 | \n", "- | \n", "- | \n", "SOUTH PASADENA | \n", "LOS ANGELES | \n", "CA | \n", "0.00000 | \n", "0.00000 | \n", "
5 rows × 83 columns
\n", "