{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import os\n", "import pandas as pd\n", "import numpy as np\n", "import seaborn as sns\n", "import matplotlib.pyplot as plt\n", "from IPython.core.display import display, HTML\n", "%matplotlib inline" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "pd.options.display.max_columns = None\n", "display(HTML(\"\"))" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "CSV_PATH = os.path.join('data', 'hacknight_ticket_sample_data_2015.csv')\n", "df = pd.read_csv(CSV_PATH,low_memory=False, parse_dates=['issue_date', 'ticket_queue_date'])" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "CSV_PATH = os.path.join('data', 'hacknight_sample_data_geocode_cleaned.csv')\n", "addrs_df = pd.read_csv(CSV_PATH)" ] }, { "cell_type": "code", "execution_count": 5, "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", " \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", " \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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
ticket_numberissue_dateviolation_locationlicense_plate_numberlicense_plate_statelicense_plate_typezipcodeviolation_codeviolation_descriptionunitunit_descriptionvehicle_makefine_level1_amountfine_level2_amountcurrent_amount_duetotal_paymentsticket_queueticket_queue_datenotice_levelhearing_dispositionnotice_numberofficeraddresslatlng
091888146212015-05-07 13:52:002134 S ARCHER AV7c189a16ef79db9413c1f46b7e5d1712e5c0c1575be352...MIPAS481030964190AEXP. METER NON-CENTRAL BUSINESS DISTRICT498DOFBUIC501000.050.0Paid2015-05-13NaNNaN07982100 s archer av, chicago, il41.854262-87.631986
191888146212015-05-07 13:52:002134 S ARCHER AV7c189a16ef79db9413c1f46b7e5d1712e5c0c1575be352...MIPAS481030964190AEXP. METER NON-CENTRAL BUSINESS DISTRICT498DOFBUIC501000.050.0Paid2015-05-13NaNNaN07982100 s archer av, chicago, il41.854262-87.631986
291888146212015-05-07 13:52:002134 S ARCHER AV7c189a16ef79db9413c1f46b7e5d1712e5c0c1575be352...MIPAS481030964190AEXP. METER NON-CENTRAL BUSINESS DISTRICT498DOFBUIC501000.050.0Paid2015-05-13NaNNaN07982100 s archer av, chicago, il41.854262-87.631986
391888146212015-05-07 13:52:002134 S ARCHER AV7c189a16ef79db9413c1f46b7e5d1712e5c0c1575be352...MIPAS481030964190AEXP. METER NON-CENTRAL BUSINESS DISTRICT498DOFBUIC501000.050.0Paid2015-05-13NaNNaN07982100 s archer av, chicago, il41.854262-87.631986
491888146212015-05-07 13:52:002134 S ARCHER AV7c189a16ef79db9413c1f46b7e5d1712e5c0c1575be352...MIPAS481030964190AEXP. METER NON-CENTRAL BUSINESS DISTRICT498DOFBUIC501000.050.0Paid2015-05-13NaNNaN07982100 s archer av, chicago, il41.854262-87.631986
\n", "
" ], "text/plain": [ " ticket_number issue_date violation_location \\\n", "0 9188814621 2015-05-07 13:52:00 2134 S ARCHER AV \n", "1 9188814621 2015-05-07 13:52:00 2134 S ARCHER AV \n", "2 9188814621 2015-05-07 13:52:00 2134 S ARCHER AV \n", "3 9188814621 2015-05-07 13:52:00 2134 S ARCHER AV \n", "4 9188814621 2015-05-07 13:52:00 2134 S ARCHER AV \n", "\n", " license_plate_number license_plate_state \\\n", "0 7c189a16ef79db9413c1f46b7e5d1712e5c0c1575be352... MI \n", "1 7c189a16ef79db9413c1f46b7e5d1712e5c0c1575be352... MI \n", "2 7c189a16ef79db9413c1f46b7e5d1712e5c0c1575be352... MI \n", "3 7c189a16ef79db9413c1f46b7e5d1712e5c0c1575be352... MI \n", "4 7c189a16ef79db9413c1f46b7e5d1712e5c0c1575be352... MI \n", "\n", " license_plate_type zipcode violation_code \\\n", "0 PAS 48103 0964190A \n", "1 PAS 48103 0964190A \n", "2 PAS 48103 0964190A \n", "3 PAS 48103 0964190A \n", "4 PAS 48103 0964190A \n", "\n", " violation_description unit unit_description \\\n", "0 EXP. METER NON-CENTRAL BUSINESS DISTRICT 498 DOF \n", "1 EXP. METER NON-CENTRAL BUSINESS DISTRICT 498 DOF \n", "2 EXP. METER NON-CENTRAL BUSINESS DISTRICT 498 DOF \n", "3 EXP. METER NON-CENTRAL BUSINESS DISTRICT 498 DOF \n", "4 EXP. METER NON-CENTRAL BUSINESS DISTRICT 498 DOF \n", "\n", " vehicle_make fine_level1_amount fine_level2_amount current_amount_due \\\n", "0 BUIC 50 100 0.0 \n", "1 BUIC 50 100 0.0 \n", "2 BUIC 50 100 0.0 \n", "3 BUIC 50 100 0.0 \n", "4 BUIC 50 100 0.0 \n", "\n", " total_payments ticket_queue ticket_queue_date notice_level \\\n", "0 50.0 Paid 2015-05-13 NaN \n", "1 50.0 Paid 2015-05-13 NaN \n", "2 50.0 Paid 2015-05-13 NaN \n", "3 50.0 Paid 2015-05-13 NaN \n", "4 50.0 Paid 2015-05-13 NaN \n", "\n", " hearing_disposition notice_number officer address \\\n", "0 NaN 0 798 2100 s archer av, chicago, il \n", "1 NaN 0 798 2100 s archer av, chicago, il \n", "2 NaN 0 798 2100 s archer av, chicago, il \n", "3 NaN 0 798 2100 s archer av, chicago, il \n", "4 NaN 0 798 2100 s archer av, chicago, il \n", "\n", " lat lng \n", "0 41.854262 -87.631986 \n", "1 41.854262 -87.631986 \n", "2 41.854262 -87.631986 \n", "3 41.854262 -87.631986 \n", "4 41.854262 -87.631986 " ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "geocoded_df = pd.merge(left=df, right=addrs_df, how='inner', on='address')\n", "geocoded_df.head()" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "Int64Index: 385682 entries, 0 to 385681\n", "Data columns (total 25 columns):\n", "ticket_number 385682 non-null int64\n", "issue_date 385682 non-null datetime64[ns]\n", "violation_location 385682 non-null object\n", "license_plate_number 385682 non-null object\n", "license_plate_state 385679 non-null object\n", "license_plate_type 382750 non-null object\n", "zipcode 318542 non-null object\n", "violation_code 385682 non-null object\n", "violation_description 385682 non-null object\n", "unit 385682 non-null int64\n", "unit_description 385682 non-null object\n", "vehicle_make 385682 non-null object\n", "fine_level1_amount 385682 non-null int64\n", "fine_level2_amount 385682 non-null int64\n", "current_amount_due 385682 non-null float64\n", "total_payments 385682 non-null float64\n", "ticket_queue 385682 non-null object\n", "ticket_queue_date 385682 non-null datetime64[ns]\n", "notice_level 275484 non-null object\n", "hearing_disposition 44913 non-null object\n", "notice_number 385682 non-null int64\n", "officer 385682 non-null object\n", "address 385682 non-null object\n", "lat 385682 non-null float64\n", "lng 385682 non-null float64\n", "dtypes: datetime64[ns](2), float64(4), int64(5), object(14)\n", "memory usage: 76.5+ MB\n" ] } ], "source": [ "geocoded_df.info()" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [], "source": [ "geocoded_df['date_diff'] = geocoded_df['ticket_queue_date'] - geocoded_df['issue_date']" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "ename": "TypeError", "evalue": "cannot astype a timedelta from [timedelta64[ns]] to [int32]", "output_type": "error", "traceback": [ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mgeocoded_df\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'date_diff'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mastype\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mint\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[1;32m~\\Anaconda3\\envs\\geo36\\lib\\site-packages\\pandas\\util\\_decorators.py\u001b[0m in \u001b[0;36mwrapper\u001b[1;34m(*args, **kwargs)\u001b[0m\n\u001b[0;32m 176\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 177\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mnew_arg_name\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mnew_arg_value\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 178\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mfunc\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m*\u001b[0m\u001b[0margs\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 179\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0mwrapper\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 180\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0m_deprecate_kwarg\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32m~\\Anaconda3\\envs\\geo36\\lib\\site-packages\\pandas\\core\\generic.py\u001b[0m in \u001b[0;36mastype\u001b[1;34m(self, dtype, copy, errors, **kwargs)\u001b[0m\n\u001b[0;32m 4999\u001b[0m \u001b[1;31m# else, only a single dtype is given\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5000\u001b[0m new_data = self._data.astype(dtype=dtype, copy=copy, errors=errors,\n\u001b[1;32m-> 5001\u001b[1;33m **kwargs)\n\u001b[0m\u001b[0;32m 5002\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_constructor\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mnew_data\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m__finalize__\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5003\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32m~\\Anaconda3\\envs\\geo36\\lib\\site-packages\\pandas\\core\\internals.py\u001b[0m in \u001b[0;36mastype\u001b[1;34m(self, dtype, **kwargs)\u001b[0m\n\u001b[0;32m 3712\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 3713\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mastype\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdtype\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 3714\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mapply\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'astype'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdtype\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mdtype\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 3715\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 3716\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mconvert\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32m~\\Anaconda3\\envs\\geo36\\lib\\site-packages\\pandas\\core\\internals.py\u001b[0m in \u001b[0;36mapply\u001b[1;34m(self, f, axes, filter, do_integrity_check, consolidate, **kwargs)\u001b[0m\n\u001b[0;32m 3579\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 3580\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'mgr'\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 3581\u001b[1;33m \u001b[0mapplied\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mb\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mf\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 3582\u001b[0m \u001b[0mresult_blocks\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0m_extend_blocks\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mapplied\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mresult_blocks\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 3583\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32m~\\Anaconda3\\envs\\geo36\\lib\\site-packages\\pandas\\core\\internals.py\u001b[0m in \u001b[0;36mastype\u001b[1;34m(self, dtype, copy, errors, values, **kwargs)\u001b[0m\n\u001b[0;32m 573\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mastype\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdtype\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcopy\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;32mFalse\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0merrors\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m'raise'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mvalues\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;32mNone\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 574\u001b[0m return self._astype(dtype, copy=copy, errors=errors, values=values,\n\u001b[1;32m--> 575\u001b[1;33m **kwargs)\n\u001b[0m\u001b[0;32m 576\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 577\u001b[0m def _astype(self, dtype, copy=False, errors='raise', values=None,\n", "\u001b[1;32m~\\Anaconda3\\envs\\geo36\\lib\\site-packages\\pandas\\core\\internals.py\u001b[0m in \u001b[0;36m_astype\u001b[1;34m(self, dtype, copy, errors, values, klass, mgr, **kwargs)\u001b[0m\n\u001b[0;32m 662\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 663\u001b[0m \u001b[1;31m# _astype_nansafe works fine with 1-d only\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 664\u001b[1;33m \u001b[0mvalues\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mastype_nansafe\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mvalues\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mravel\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdtype\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcopy\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;32mTrue\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 665\u001b[0m \u001b[0mvalues\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mvalues\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mreshape\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mshape\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 666\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32m~\\Anaconda3\\envs\\geo36\\lib\\site-packages\\pandas\\core\\dtypes\\cast.py\u001b[0m in \u001b[0;36mastype_nansafe\u001b[1;34m(arr, dtype, copy)\u001b[0m\n\u001b[0;32m 694\u001b[0m raise TypeError(\"cannot astype a timedelta from [{from_dtype}] \"\n\u001b[0;32m 695\u001b[0m \"to [{to_dtype}]\".format(from_dtype=arr.dtype,\n\u001b[1;32m--> 696\u001b[1;33m to_dtype=dtype))\n\u001b[0m\u001b[0;32m 697\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 698\u001b[0m elif (np.issubdtype(arr.dtype, np.floating) and\n", "\u001b[1;31mTypeError\u001b[0m: cannot astype a timedelta from [timedelta64[ns]] to [int32]" ] } ], "source": [ "geocoded_df['date_diff'].astype(int)" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "ename": "TypeError", "evalue": "cannot compare a TimedeltaIndex with type int", "output_type": "error", "traceback": [ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mgeocoded_df\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mgeocoded_df\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'date_diff'\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m>\u001b[0m \u001b[1;36m90\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m&\u001b[0m \u001b[1;33m(\u001b[0m\u001b[0mgeocoded_df\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'ticket_queue'\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m==\u001b[0m \u001b[1;34m'Paid'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[1;32m~\\Anaconda3\\envs\\geo36\\lib\\site-packages\\pandas\\core\\ops.py\u001b[0m in \u001b[0;36mwrapper\u001b[1;34m(self, other, axis)\u001b[0m\n\u001b[0;32m 1235\u001b[0m \u001b[1;32melif\u001b[0m \u001b[0mis_timedelta64_dtype\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1236\u001b[0m res_values = dispatch_to_index_op(op, self, other,\n\u001b[1;32m-> 1237\u001b[1;33m pd.TimedeltaIndex)\n\u001b[0m\u001b[0;32m 1238\u001b[0m return self._constructor(res_values, index=self.index,\n\u001b[0;32m 1239\u001b[0m name=res_name)\n", "\u001b[1;32m~\\Anaconda3\\envs\\geo36\\lib\\site-packages\\pandas\\core\\ops.py\u001b[0m in \u001b[0;36mdispatch_to_index_op\u001b[1;34m(op, left, right, index_class)\u001b[0m\n\u001b[0;32m 1099\u001b[0m \u001b[0mleft_idx\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mleft_idx\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_shallow_copy\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfreq\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;32mNone\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1100\u001b[0m \u001b[1;32mtry\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 1101\u001b[1;33m \u001b[0mresult\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mop\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mleft_idx\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mright\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 1102\u001b[0m \u001b[1;32mexcept\u001b[0m \u001b[0mNullFrequencyError\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1103\u001b[0m \u001b[1;31m# DatetimeIndex and TimedeltaIndex with freq == None raise ValueError\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32m~\\Anaconda3\\envs\\geo36\\lib\\site-packages\\pandas\\core\\indexes\\timedeltas.py\u001b[0m in \u001b[0;36mwrapper\u001b[1;34m(self, other)\u001b[0m\n\u001b[0;32m 76\u001b[0m \u001b[1;32melif\u001b[0m \u001b[1;32mnot\u001b[0m \u001b[0mis_list_like\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mother\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 77\u001b[0m raise TypeError(msg.format(cls=type(self).__name__,\n\u001b[1;32m---> 78\u001b[1;33m typ=type(other).__name__))\n\u001b[0m\u001b[0;32m 79\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 80\u001b[0m \u001b[0mother\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mTimedeltaIndex\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mother\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mvalues\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;31mTypeError\u001b[0m: cannot compare a TimedeltaIndex with type int" ] } ], "source": [ "geocoded_df[(geocoded_df['date_diff'] > 90) & (geocoded_df['ticket_queue'] == 'Paid')]" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python [conda env:geo36]", "language": "python", "name": "conda-env-geo36-py" }, "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.6.6" } }, "nbformat": 4, "nbformat_minor": 2 }