{ "metadata": { "name": "", "signature": "sha256:29897a9f8041bb301bd1fb41356d238d8ccf7902ba369eb1d9acc34f5f990953" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "code", "collapsed": false, "input": [ "import pandas as pd\n", "\n", "#csv_path = 'https://raw.githubusercontent.com/nygeog/data/master/nyc_crashes/data/NYPD_Motor_Vehicle_Collisions.csv'\n", "inCSV = 'data/NYPD_Motor_Vehicle_Collisions.csv'\n", "ouCSV = 'data/nypd_mv_collisions.csv'\n", "\n", "df = pd.read_csv(inCSV).rename(columns=lambda x: x.lower())\n", "\n", "#drop ones w/out valid lat #super lazy, just grabbing lat's above 35\n", "df = df[(df.latitude > 35)]\n", "#print df.dtypes \n", "print len(df.index)\n", "df.head(5)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "449644\n" ] }, { "html": [ "
\n", " | date | \n", "time | \n", "borough | \n", "zip code | \n", "latitude | \n", "longitude | \n", "location | \n", "on street name | \n", "cross street name | \n", "off street name | \n", "... | \n", "contributing factor vehicle 2 | \n", "contributing factor vehicle 3 | \n", "contributing factor vehicle 4 | \n", "contributing factor vehicle 5 | \n", "unique key | \n", "vehicle type code 1 | \n", "vehicle type code 2 | \n", "vehicle type code 3 | \n", "vehicle type code 4 | \n", "vehicle type code 5 | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | \n", "02/13/2015 | \n", "21:45 | \n", "MANHATTAN | \n", "10002 | \n", "40.715622 | \n", "-73.994275 | \n", "(40.7156221, -73.9942752) | \n", "FORSYTH STREET | \n", "CANAL STREET | \n", "NaN | \n", "... | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "3168577 | \n", "PASSENGER VEHICLE | \n", "UNKNOWN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
2 | \n", "02/13/2015 | \n", "21:45 | \n", "MANHATTAN | \n", "10001 | \n", "40.747535 | \n", "-73.988307 | \n", "(40.7475349, -73.9883068) | \n", "WEST 31 STREET | \n", "BROADWAY | \n", "NaN | \n", "... | \n", "Fatigued/Drowsy | \n", "NaN | \n", "NaN | \n", "NaN | \n", "3169163 | \n", "TAXI | \n", "TAXI | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
3 | \n", "02/13/2015 | \n", "21:45 | \n", "BRONX | \n", "10462 | \n", "40.833558 | \n", "-73.857732 | \n", "(40.8335582, -73.8577325) | \n", "WESTCHESTER AVENUE | \n", "PUGSLEY AVENUE | \n", "NaN | \n", "... | \n", "Unspecified | \n", "NaN | \n", "NaN | \n", "NaN | \n", "3169251 | \n", "PASSENGER VEHICLE | \n", "SPORT UTILITY / STATION WAGON | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
4 | \n", "02/13/2015 | \n", "21:44 | \n", "MANHATTAN | \n", "10017 | \n", "40.748800 | \n", "-73.969846 | \n", "(40.7487997, -73.969846) | \n", "EAST 42 STREET | \n", "1 AVENUE | \n", "NaN | \n", "... | \n", "Other Vehicular | \n", "NaN | \n", "NaN | \n", "NaN | \n", "3169176 | \n", "PASSENGER VEHICLE | \n", "PASSENGER VEHICLE | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
5 | \n", "02/13/2015 | \n", "21:40 | \n", "STATEN ISLAND | \n", "10304 | \n", "40.617295 | \n", "-74.080479 | \n", "(40.6172954, -74.0804791) | \n", "PARK HILL AVENUE | \n", "OSGOOD AVENUE | \n", "NaN | \n", "... | \n", "Unspecified | \n", "NaN | \n", "NaN | \n", "NaN | \n", "3169614 | \n", "PASSENGER VEHICLE | \n", "PASSENGER VEHICLE | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
5 rows \u00d7 29 columns
\n", "\n", " | datetime | \n", "latitude | \n", "longitude | \n", "
---|---|---|---|
228854 | \n", "2014-01-01 00:01:00 | \n", "40.725432 | \n", "-73.996771 | \n", "
228850 | \n", "2014-01-01 00:01:00 | \n", "40.767889 | \n", "-73.981512 | \n", "
228855 | \n", "2014-01-01 00:01:00 | \n", "40.750844 | \n", "-73.978608 | \n", "
229144 | \n", "2014-01-01 00:15:00 | \n", "40.588646 | \n", "-73.992452 | \n", "
228849 | \n", "2014-01-01 00:20:00 | \n", "40.689019 | \n", "-73.986157 | \n", "