{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
YEAR OF STOPDATE OF STOPRACE OF DRIVERGENDER OF DRIVERDRIVER SEARCHED?VEHICLE SEARCHED?CITATION ISSUED?AGE OF DRIVERREASON FOR STOPPOLICE GRID NUMBERLOCATION OF STOP BY POLICE GRIDCOUNT
0200101/01/2001 12:11:00 AMWhiteFemaleNoNoNoNaNNo Data55.0(44.97391713, -93.06089457)1
1200101/01/2001 12:14:00 AMWhiteMaleNoNoNoNaNNo Data106.0(44.95211807, -93.15173337)1
\n", "
" ], "text/plain": [ " YEAR OF STOP DATE OF STOP RACE OF DRIVER GENDER OF DRIVER \\\n", "0 2001 01/01/2001 12:11:00 AM White Female \n", "1 2001 01/01/2001 12:14:00 AM White Male \n", "\n", " DRIVER SEARCHED? VEHICLE SEARCHED? CITATION ISSUED? AGE OF DRIVER \\\n", "0 No No No NaN \n", "1 No No No NaN \n", "\n", " REASON FOR STOP POLICE GRID NUMBER LOCATION OF STOP BY POLICE GRID COUNT \n", "0 No Data 55.0 (44.97391713, -93.06089457) 1 \n", "1 No Data 106.0 (44.95211807, -93.15173337) 1 " ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "\n", "\n", "import pandas as pd\n", "import numpy as np\n", "from datetime import datetime\n", "import warnings\n", "%matplotlib inline \n", "import matplotlib as mpl\n", "import matplotlib.pyplot as plt\n", "warnings.filterwarnings('ignore')\n", "import plotly\n", "from IPython.display import HTML\n", "from IPython.display import display\n", "import json # library to handle JSON files\n", "from geopy.geocoders import Nominatim # convert an address into latitude and longitude values\n", "import requests # library to handle requests\n", "from pandas.io.json import json_normalize # tranform JSON file into a pandas dataframe\n", "from sodapy import Socrata\n", "\n", "#Data Load\n", "df = pd.read_csv('Data/Traffic_Stop_Dataset.csv')\n", "\n", "cols= ['Year','Date','Race','Gender','Driver_search','Vehicle_search','Citation','Age','Reason','Grid','GridLocation', 'Count']\n", "df.columns= cols\n", "\n", "df.head(2)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "cols= ['Year','Date','Race','Gender','Driver_search','Vehicle_search','Citation','Age','Reason','Grid','GridLocation', 'Count']\n", "df.columns= cols" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.3" } }, "nbformat": 4, "nbformat_minor": 2 }