In [1]:
import pandas as pd
import pg8000
conn = pg8000.connect(host='training.c1erymiua9dx.us-east-1.rds.amazonaws.com', port=5432, database='training', user='dot_student', password='qgis')

In [2]:
cursor = conn.cursor()

In [4]:
conn.rollback()

In [9]:
# cursor.execute("SELECT * FROM noise_311")

In [10]:
df = pd.read_sql("SELECT * FROM noise_311", conn)

In [12]:
df.head()


Out[12]:
b'unique_key' b'created_date' b'closed_date' b'agency' b'agency_name' b'complaint_type' b'descriptor' b'location_type' b'incident_zip' b'incident_address' ... b'bridge_highway_name' b'bridge_highway_direction' b'road_ramp' b'bridge_highway_segment' b'garage_lot_name' b'ferry_direction' b'ferry_terminal_name' b'latitude' b'longitude' b'location'
0 28792167 2014-08-31 23:59:00 2014-09-01 03:52:00 NYPD New York City Police Department Noise - Street/Sidewalk Loud Music/Party Street/Sidewalk 11222 200 KINGSLAND AVENUE ... None None None None None None None 40.723888 -73.941349 (40.723888303549415, -73.94134888943505)
1 28789088 2014-08-31 23:56:00 2014-09-01 06:17:00 NYPD New York City Police Department Noise - Vehicle Car/Truck Music Street/Sidewalk 11234 FLATLANDS AVENUE ... None None None None None None None 40.619489 -73.938051 (40.61948901090983, -73.93805104516916)
2 28791854 2014-08-31 23:54:00 2014-09-01 01:29:00 NYPD New York City Police Department Noise - Commercial Loud Music/Party Club/Bar/Restaurant 10002 161 LUDLOW STREET ... None None None None None None None 40.721410 -73.987694 (40.72141034382407, -73.98769444021134)
3 28789936 2014-08-31 23:52:00 2014-09-01 02:53:00 NYPD New York City Police Department Noise - Street/Sidewalk Loud Music/Party Street/Sidewalk 10033 624 WEST 182 STREET ... None None None None None None None 40.850167 -73.933972 (40.85016671877659, -73.93397220795968)
4 28789931 2014-08-31 23:47:00 2014-09-01 01:06:00 NYPD New York City Police Department Noise - Street/Sidewalk Loud Music/Party Street/Sidewalk 11217 525 DEAN STREET ... None None None None None None None 40.681208 -73.972775 (40.68120794066068, -73.97277535440028)

5 rows × 53 columns


In [20]:
df.columns


Out[20]:
Index([                    b'unique_key',                   b'created_date',
                          b'closed_date',                         b'agency',
                          b'agency_name',                 b'complaint_type',
                           b'descriptor',                  b'location_type',
                         b'incident_zip',               b'incident_address',
                          b'street_name',                 b'cross_street_1',
                       b'cross_street_2',          b'intersection_street_1',
                b'intersection_street_2',                   b'address_type',
                                 b'city',                       b'landmark',
                        b'facility_type',                         b'status',
                             b'due_date',         b'resolution_description',
       b'resolution_action_updated_date',                b'community_board',
                              b'borough',                   b'x_coordinate',
                         b'y_coordinate',             b'park_facility_name',
                         b'park_borough',                    b'school_name',
                        b'school_number',                  b'school_region',
                          b'school_code',            b'school_phone_number',
                       b'school_address',                    b'school_city',
                         b'school_state',                     b'school_zip',
                     b'school_not_found',   b'school_or_citywide_complaint',
                         b'vehicle_type',           b'taxi_company_borough',
                b'taxi_pick_up_location',            b'bridge_highway_name',
             b'bridge_highway_direction',                      b'road_ramp',
               b'bridge_highway_segment',                b'garage_lot_name',
                      b'ferry_direction',            b'ferry_terminal_name',
                             b'latitude',                      b'longitude',
                             b'location'],
      dtype='object')

In [28]:
df.columns = (                    'unique_key',                   'created',
                          'closed',                         b'agency',
                          b'agency_name',                 b'complaint_type',
                           b'descriptor',                  b'location_type',
                         b'incident_zip',               b'incident_address',
                          b'street_name',                 b'cross_street_1',
                       b'cross_street_2',          b'intersection_street_1',
                b'intersection_street_2',                   b'address_type',
                                 b'city',                       b'landmark',
                        b'facility_type',                         b'status',
                             b'due_date',         b'resolution_description',
       b'resolution_action_updated_date',                b'community_board',
                              b'borough',                   b'x_coordinate',
                         b'y_coordinate',             b'park_facility_name',
                         b'park_borough',                    b'school_name',
                        b'school_number',                  b'school_region',
                          b'school_code',            b'school_phone_number',
                       b'school_address',                    b'school_city',
                         b'school_state',                     b'school_zip',
                     b'school_not_found',   b'school_or_citywide_complaint',
                         b'vehicle_type',           b'taxi_company_borough',
                b'taxi_pick_up_location',            b'bridge_highway_name',
             b'bridge_highway_direction',                      b'road_ramp',
               b'bridge_highway_segment',                b'garage_lot_name',
                      b'ferry_direction',            b'ferry_terminal_name',
                             b'latitude',                      b'longitude',
                             b'location')

In [29]:
df


Out[29]:
unique_key created closed b'agency' b'agency_name' b'complaint_type' b'descriptor' b'location_type' b'incident_zip' b'incident_address' ... b'bridge_highway_name' b'bridge_highway_direction' b'road_ramp' b'bridge_highway_segment' b'garage_lot_name' b'ferry_direction' b'ferry_terminal_name' b'latitude' b'longitude' b'location'
0 28792167 2014-08-31 23:59:00 2014-09-01 03:52:00 NYPD New York City Police Department Noise - Street/Sidewalk Loud Music/Party Street/Sidewalk 11222 200 KINGSLAND AVENUE ... None None None None None None None 40.723888 -73.941349 (40.723888303549415, -73.94134888943505)
1 28789088 2014-08-31 23:56:00 2014-09-01 06:17:00 NYPD New York City Police Department Noise - Vehicle Car/Truck Music Street/Sidewalk 11234 FLATLANDS AVENUE ... None None None None None None None 40.619489 -73.938051 (40.61948901090983, -73.93805104516916)
2 28791854 2014-08-31 23:54:00 2014-09-01 01:29:00 NYPD New York City Police Department Noise - Commercial Loud Music/Party Club/Bar/Restaurant 10002 161 LUDLOW STREET ... None None None None None None None 40.721410 -73.987694 (40.72141034382407, -73.98769444021134)
3 28789936 2014-08-31 23:52:00 2014-09-01 02:53:00 NYPD New York City Police Department Noise - Street/Sidewalk Loud Music/Party Street/Sidewalk 10033 624 WEST 182 STREET ... None None None None None None None 40.850167 -73.933972 (40.85016671877659, -73.93397220795968)
4 28789931 2014-08-31 23:47:00 2014-09-01 01:06:00 NYPD New York City Police Department Noise - Street/Sidewalk Loud Music/Party Street/Sidewalk 11217 525 DEAN STREET ... None None None None None None None 40.681208 -73.972775 (40.68120794066068, -73.97277535440028)
5 28790974 2014-08-31 23:46:00 2014-09-01 02:52:00 NYPD New York City Police Department Noise - Vehicle Car/Truck Music Street/Sidewalk 10034 None ... None None None None None None None 40.867276 -73.919215 (40.867276028886835, -73.9192147239671)
6 28788883 2014-08-31 23:43:00 2014-09-01 00:47:00 NYPD New York City Police Department Noise - Vehicle Car/Truck Music Street/Sidewalk 10463 3815 PUTNAM AVENUE WEST ... None None None None None None None 40.884763 -73.898735 (40.88476278238543, -73.89873506548597)
7 28791627 2014-08-31 23:42:00 2014-09-01 04:00:00 NYPD New York City Police Department Noise - Commercial Loud Music/Party Club/Bar/Restaurant 10009 16 FIRST AVENUE ... None None None None None None None 40.723494 -73.988253 (40.72349367369547, -73.98825325266078)
8 28791754 2014-08-31 23:42:00 2014-09-01 04:30:00 NYPD New York City Police Department Noise - Park Loud Music/Party Park/Playground 10473 None ... None None None None None None None 40.820151 -73.872470 (40.820151079334636, -73.87246956983442)
9 28791202 2014-08-31 23:40:00 2014-09-01 03:05:00 NYPD New York City Police Department Noise - Commercial Loud Music/Party Store/Commercial 11216 665 FRANKLIN AVENUE ... None None None None None None None 40.675702 -73.955913 (40.675702188086944, -73.95591276456229)
10 28788981 2014-08-31 23:38:00 2014-09-01 04:30:00 NYPD New York City Police Department Noise - Street/Sidewalk Loud Music/Party Street/Sidewalk 10473 None ... None None None None None None None 40.815799 -73.870928 (40.81579897978756, -73.87092804807793)
11 28792536 2014-08-31 23:37:00 2014-09-01 02:13:00 NYPD New York City Police Department Noise - Vehicle Car/Truck Music Street/Sidewalk 10040 ST NICHOLAS AVENUE ... None None None None None None None 40.853996 -73.930314 (40.8539961736313, -73.93031384051778)
12 28788983 2014-08-31 23:37:00 2014-09-01 03:31:00 NYPD New York City Police Department Noise - Street/Sidewalk Loud Music/Party Street/Sidewalk 11411 None ... None None None None None None None 40.695138 -73.740138 (40.695138441616756, -73.74013763661145)
13 28792074 2014-08-31 23:34:00 2014-09-01 04:47:00 NYPD New York City Police Department Noise - Street/Sidewalk Loud Music/Party Street/Sidewalk 10452 158 EAST 164 STREET ... None None None None None None None 40.829887 -73.921952 (40.82988678524287, -73.92195217298081)
14 28789395 2014-08-31 23:33:00 2014-09-01 02:39:00 NYPD New York City Police Department Noise - Street/Sidewalk Loud Music/Party Street/Sidewalk 10465 3085 WISSMAN AVENUE ... None None None None None None None 40.820123 -73.810283 (40.8201231710228, -73.81028321862068)
15 28791975 2014-08-31 23:28:00 2014-09-01 00:28:00 NYPD New York City Police Department Noise - Street/Sidewalk Loud Music/Party Street/Sidewalk 10032 516 WEST 167 STREET ... None None None None None None None 40.839588 -73.938070 (40.839588145100706, -73.93807016387643)
16 28790952 2014-08-31 23:28:00 2014-09-01 02:55:00 NYPD New York City Police Department Noise - Street/Sidewalk Loud Music/Party Street/Sidewalk 10451 None ... None None None None None None None 40.823385 -73.918339 (40.82338479560645, -73.91833943226857)
17 28790593 2014-08-31 23:27:00 2014-09-01 12:59:00 NYPD New York City Police Department Noise - Street/Sidewalk Loud Talking Street/Sidewalk 10469 3480 CORSA AVENUE ... None None None None None None None 40.877892 -73.847907 (40.87789192345351, -73.84790671078991)
18 28790787 2014-08-31 23:25:00 2014-09-01 01:10:00 NYPD New York City Police Department Noise - Park Loud Talking Park/Playground 11215 None ... None None None None None None None 40.672767 -73.986708 (40.67276746813732, -73.98670844073)
19 28791377 2014-08-31 23:25:00 2014-09-01 02:13:00 NYPD New York City Police Department Noise - Street/Sidewalk Loud Music/Party Street/Sidewalk 10034 VERMILYEA AVENUE ... None None None None None None None 40.867323 -73.919215 (40.86732268869463, -73.91921466728289)
20 28791028 2014-08-31 23:25:00 2014-09-01 05:19:00 NYPD New York City Police Department Noise - Street/Sidewalk Loud Music/Party Street/Sidewalk 11225 991 PRESIDENT STREET ... None None None None None None None 40.669100 -73.959540 (40.66909958968033, -73.95953993434152)
21 28791108 2014-08-31 23:23:00 2014-08-31 23:30:00 NYPD New York City Police Department Noise - Vehicle Engine Idling Street/Sidewalk 10304 28 THEATER LANE ... None None None None None None None 40.613964 -74.080090 (40.6139635127871, -74.08008972068842)
22 28790849 2014-08-31 23:23:00 2014-08-31 23:56:00 NYPD New York City Police Department Noise - Street/Sidewalk Loud Music/Party Street/Sidewalk 11225 None ... None None None None None None None 40.669641 -73.962193 (40.66964121313612, -73.96219274656046)
23 28789398 2014-08-31 23:21:00 2014-09-01 02:12:00 NYPD New York City Police Department Noise - Street/Sidewalk Loud Music/Party Street/Sidewalk 10040 1 SHERMAN AVE ... None None None None None None None 40.862018 -73.929203 (40.862018258681125, -73.92920278665066)
24 28791004 2014-08-31 23:18:00 2014-09-01 04:45:00 NYPD New York City Police Department Noise - Park Loud Music/Party Park/Playground 10452 975 WALTON AVENUE ... None None None None None None None 40.829248 -73.922892 (40.829247899200524, -73.92289242169471)
25 28791252 2014-08-31 23:17:00 2014-08-31 23:38:00 NYPD New York City Police Department Noise - Commercial Loud Music/Party Club/Bar/Restaurant 11233 370 LEWIS AVENUE ... None None None None None None None 40.682930 -73.935050 (40.68293027183319, -73.93504999741602)
26 28789888 2014-08-31 23:17:00 2014-09-01 01:29:00 NYPD New York City Police Department Noise - Street/Sidewalk Loud Music/Party Street/Sidewalk 10002 170 LUDLOW STREET ... None None None None None None None 40.721586 -73.987583 (40.7215859963632, -73.98758257155433)
27 28788887 2014-08-31 23:16:00 2014-09-01 02:02:00 NYPD New York City Police Department Noise - Street/Sidewalk Loud Music/Party Street/Sidewalk 11236 None ... None None None None None None None 40.646719 -73.908185 (40.64671930675259, -73.90818457082274)
28 28788858 2014-08-31 23:16:00 2014-09-01 02:12:00 NYPD New York City Police Department Noise - Street/Sidewalk Loud Music/Party Street/Sidewalk 10034 None ... None None None None None None None 40.867276 -73.919215 (40.867276028886835, -73.9192147239671)
29 28791005 2014-08-31 23:15:00 2014-09-01 04:28:00 NYPD New York City Police Department Noise - Street/Sidewalk Loud Music/Party Street/Sidewalk 10473 825 MORRISON AVE ... None None None None None None None 40.820597 -73.873209 (40.82059653996134, -73.87320937939411)
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
37585 28157550 2014-06-01 00:24:00 2014-06-01 03:26:00 NYPD New York City Police Department Noise - Commercial Loud Music/Party Club/Bar/Restaurant 11004 83-47 258 STREET ... None None None None None None None 40.737892 -73.710464 (40.73789159992381, -73.71046402051948)
37586 28157347 2014-06-01 00:23:00 2014-06-01 04:37:00 NYPD New York City Police Department Noise - Vehicle Car/Truck Horn Street/Sidewalk 11249 91 BROADWAY ... None None None None None None None 40.710457 -73.965192 (40.71045688892934, -73.96519227754882)
37587 28159965 2014-06-01 00:23:00 2014-06-01 02:14:00 NYPD New York City Police Department Noise - Commercial Loud Music/Party Club/Bar/Restaurant 10028 1640 2 AVENUE ... None None None None None None None 40.777292 -73.952155 (40.77729236881097, -73.95215543230414)
37588 28159739 2014-06-01 00:22:00 2014-06-01 04:46:00 NYPD New York City Police Department Noise - Street/Sidewalk Loud Music/Party Street/Sidewalk 11233 1621 EASTERN PARKWAY ... None None None None None None None 40.671702 -73.914574 (40.67170174011723, -73.91457415354401)
37589 28162287 2014-06-01 00:21:00 2014-06-01 01:03:00 NYPD New York City Police Department Noise - Street/Sidewalk Loud Talking Street/Sidewalk 10030 301-319 WEST 134TH STREET ... None None None None None None None 40.816054 -73.947518 (40.81605415517306, -73.94751770737254)
37590 28160504 2014-06-01 00:20:00 2014-06-01 06:36:00 NYPD New York City Police Department Noise - Vehicle Car/Truck Music Street/Sidewalk 10451 None ... None None None None None None None 40.829958 -73.930086 (40.829957876314346, -73.93008607198803)
37591 28158656 2014-06-01 00:19:00 2014-06-01 02:10:00 NYPD New York City Police Department Noise - Street/Sidewalk Loud Music/Party Street/Sidewalk 10026 240 WEST 112 STREET ... None None None None None None None 40.801338 -73.956025 (40.80133776158354, -73.95602459997275)
37592 28157266 2014-06-01 00:18:00 2014-06-01 00:57:00 NYPD New York City Police Department Noise - Vehicle Car/Truck Music Street/Sidewalk 10025 None ... None None None None None None None 40.793981 -73.972281 (40.79398145623041, -73.97228140520521)
37593 28161992 2014-06-01 00:17:00 2014-06-01 05:04:00 NYPD New York City Police Department Noise - Street/Sidewalk Loud Talking Street/Sidewalk 10468 2505 AQUEDUCT AVENUE WEST ... None None None None None None None 40.865193 -73.902290 (40.865193436175176, -73.90228989262104)
37594 28159165 2014-06-01 00:16:00 2014-06-01 01:03:00 NYPD New York City Police Department Noise - Commercial Loud Music/Party Club/Bar/Restaurant 11237 1495 DEKALB AVENUE ... None None None None None None None 40.701696 -73.921814 (40.70169626675707, -73.92181372712216)
37595 28159130 2014-06-01 00:14:00 2014-06-01 01:04:00 NYPD New York City Police Department Noise - Commercial Loud Music/Party Club/Bar/Restaurant 11103 32-72 STEINWAY STREET ... None None None None None None None 40.757299 -73.920373 (40.75729855854012, -73.92037322099308)
37596 28157729 2014-06-01 00:14:00 2014-06-01 02:12:00 NYPD New York City Police Department Noise - Park Loud Music/Party Park/Playground 10027 426 ST NICHOLAS AVENUE ... None None None None None None None 40.814551 -73.949296 (40.814550844132924, -73.9492963216322)
37597 28156960 2014-06-01 00:14:00 2014-06-01 01:42:00 NYPD New York City Police Department Noise - Commercial Loud Music/Party Club/Bar/Restaurant 11432 172-11 HILLSIDE AVENUE ... None None None None None None None 40.711849 -73.789865 (40.71184860073022, -73.78986498358812)
37598 28161664 2014-06-01 00:13:00 2014-06-01 02:10:00 NYPD New York City Police Department Noise - Street/Sidewalk Loud Music/Party Street/Sidewalk 10026 None ... None None None None None None None 40.805098 -73.954873 (40.80509759117871, -73.95487345326087)
37599 28160221 2014-06-01 00:12:00 2014-06-01 02:19:00 NYPD New York City Police Department Noise - Street/Sidewalk Loud Talking Street/Sidewalk 11238 90 DOWNING STREET ... None None None None None None None 40.683343 -73.960836 (40.683342674459816, -73.9608365021689)
37600 28158625 2014-06-01 00:10:00 2014-06-01 02:31:00 NYPD New York City Police Department Noise - Street/Sidewalk Loud Music/Party Street/Sidewalk 10040 None ... None None None None None None None 40.862150 -73.929651 (40.86215027835525, -73.92965093665484)
37601 28161077 2014-06-01 00:09:00 2014-06-01 03:14:00 NYPD New York City Police Department Noise - Street/Sidewalk Loud Music/Party Street/Sidewalk 10455 630 JACKSON AVENUE ... None None None None None None None 40.814638 -73.907751 (40.81463762219387, -73.90775060332443)
37602 28157263 2014-06-01 00:09:00 2014-06-01 03:05:00 NYPD New York City Police Department Noise - Street/Sidewalk Loud Talking Street/Sidewalk 11218 OCEAN PKWY ... None None None None None None None 40.640800 -73.973696 (40.64079951115844, -73.97369625738399)
37603 28159956 2014-06-01 00:09:00 2014-06-01 01:04:00 NYPD New York City Police Department Noise - Commercial Loud Music/Party Store/Commercial 11237 None ... None None None None None None None 40.701832 -73.919321 (40.7018317851356, -73.91932144034594)
37604 28162132 2014-06-01 00:06:00 2014-06-01 01:20:00 NYPD New York City Police Department Noise - Commercial Loud Music/Party Club/Bar/Restaurant 11231 449 COURT STREET ... None None None None None None None 40.677753 -73.998111 (40.677752731414074, -73.99811084956158)
37605 28159435 2014-06-01 00:06:00 2014-06-01 01:41:00 NYPD New York City Police Department Noise - Street/Sidewalk Loud Music/Party Street/Sidewalk 10032 600 WEST 164 STREET ... None None None None None None None 40.838569 -73.942046 (40.83856917947116, -73.94204647344907)
37606 28162516 2014-06-01 00:05:00 2014-06-01 14:07:00 NYPD New York City Police Department Noise - Vehicle Car/Truck Horn Street/Sidewalk 10022 None ... None None None None None None None 40.759620 -73.961965 (40.759619895228845, -73.96196479954183)
37607 28157374 2014-06-01 00:03:00 2014-06-01 03:15:00 NYPD New York City Police Department Noise - Street/Sidewalk Loud Music/Party Street/Sidewalk 10455 625 JACKSON AVENUE ... None None None None None None None 40.815355 -73.908443 (40.81535454669349, -73.90844324894069)
37608 28159445 2014-06-01 00:02:00 2014-06-01 01:44:00 NYPD New York City Police Department Noise - Street/Sidewalk Loud Talking Street/Sidewalk 11226 1823-1999 NEW YORK 27 ... None None None None None None None 40.651847 -73.962242 (40.6518468223244, -73.96224247276845)
37609 28156952 2014-06-01 00:02:00 2014-06-01 01:14:00 NYPD New York City Police Department Noise - Commercial Loud Music/Party Store/Commercial 10011 51 W 8TH ST ... None None None None None None None 40.733425 -73.998636 (40.733424791922275, -73.99863607731642)
37610 28161969 2014-06-01 00:02:00 2014-06-01 10:26:00 NYPD New York City Police Department Noise - Commercial Loud Music/Party Club/Bar/Restaurant 11216 608 NOSTRAND AVENUE ... None None None None None None None 40.677808 -73.949764 (40.67780765486066, -73.94976441731157)
37611 28157261 2014-06-01 00:02:00 2014-06-01 02:26:00 NYPD New York City Police Department Noise - Street/Sidewalk Loud Talking Street/Sidewalk 11211 None ... None None None None None None None 40.708900 -73.954719 (40.708899709495455, -73.9547185546482)
37612 28162458 2014-06-01 00:01:00 2014-06-01 04:39:00 NYPD New York City Police Department Noise - Vehicle Car/Truck Horn Street/Sidewalk 11208 679 ELDERT LANE ... None None None None None None None 40.673418 -73.863784 (40.67341770952538, -73.86378446869332)
37613 28162216 2014-06-01 00:00:00 2014-06-01 02:14:00 NYPD New York City Police Department Noise - Vehicle Car/Truck Horn Street/Sidewalk 10065 None ... None None None None None None None 40.762106 -73.960137 (40.76210601492712, -73.96013681333878)
37614 28162314 2014-06-01 00:00:00 2014-06-01 07:38:00 NYPD New York City Police Department Noise - Commercial Loud Music/Party Store/Commercial 11249 140 GRAND STREET ... None None None None None None None 40.714691 -73.962441 (40.71469119215372, -73.96244134390749)

37615 rows × 53 columns


In [30]:
selection = df[['unique_key', 'created', 'closed']]

In [31]:
selection


Out[31]:
unique_key created closed
0 28792167 2014-08-31 23:59:00 2014-09-01 03:52:00
1 28789088 2014-08-31 23:56:00 2014-09-01 06:17:00
2 28791854 2014-08-31 23:54:00 2014-09-01 01:29:00
3 28789936 2014-08-31 23:52:00 2014-09-01 02:53:00
4 28789931 2014-08-31 23:47:00 2014-09-01 01:06:00
5 28790974 2014-08-31 23:46:00 2014-09-01 02:52:00
6 28788883 2014-08-31 23:43:00 2014-09-01 00:47:00
7 28791627 2014-08-31 23:42:00 2014-09-01 04:00:00
8 28791754 2014-08-31 23:42:00 2014-09-01 04:30:00
9 28791202 2014-08-31 23:40:00 2014-09-01 03:05:00
10 28788981 2014-08-31 23:38:00 2014-09-01 04:30:00
11 28792536 2014-08-31 23:37:00 2014-09-01 02:13:00
12 28788983 2014-08-31 23:37:00 2014-09-01 03:31:00
13 28792074 2014-08-31 23:34:00 2014-09-01 04:47:00
14 28789395 2014-08-31 23:33:00 2014-09-01 02:39:00
15 28791975 2014-08-31 23:28:00 2014-09-01 00:28:00
16 28790952 2014-08-31 23:28:00 2014-09-01 02:55:00
17 28790593 2014-08-31 23:27:00 2014-09-01 12:59:00
18 28790787 2014-08-31 23:25:00 2014-09-01 01:10:00
19 28791377 2014-08-31 23:25:00 2014-09-01 02:13:00
20 28791028 2014-08-31 23:25:00 2014-09-01 05:19:00
21 28791108 2014-08-31 23:23:00 2014-08-31 23:30:00
22 28790849 2014-08-31 23:23:00 2014-08-31 23:56:00
23 28789398 2014-08-31 23:21:00 2014-09-01 02:12:00
24 28791004 2014-08-31 23:18:00 2014-09-01 04:45:00
25 28791252 2014-08-31 23:17:00 2014-08-31 23:38:00
26 28789888 2014-08-31 23:17:00 2014-09-01 01:29:00
27 28788887 2014-08-31 23:16:00 2014-09-01 02:02:00
28 28788858 2014-08-31 23:16:00 2014-09-01 02:12:00
29 28791005 2014-08-31 23:15:00 2014-09-01 04:28:00
... ... ... ...
37585 28157550 2014-06-01 00:24:00 2014-06-01 03:26:00
37586 28157347 2014-06-01 00:23:00 2014-06-01 04:37:00
37587 28159965 2014-06-01 00:23:00 2014-06-01 02:14:00
37588 28159739 2014-06-01 00:22:00 2014-06-01 04:46:00
37589 28162287 2014-06-01 00:21:00 2014-06-01 01:03:00
37590 28160504 2014-06-01 00:20:00 2014-06-01 06:36:00
37591 28158656 2014-06-01 00:19:00 2014-06-01 02:10:00
37592 28157266 2014-06-01 00:18:00 2014-06-01 00:57:00
37593 28161992 2014-06-01 00:17:00 2014-06-01 05:04:00
37594 28159165 2014-06-01 00:16:00 2014-06-01 01:03:00
37595 28159130 2014-06-01 00:14:00 2014-06-01 01:04:00
37596 28157729 2014-06-01 00:14:00 2014-06-01 02:12:00
37597 28156960 2014-06-01 00:14:00 2014-06-01 01:42:00
37598 28161664 2014-06-01 00:13:00 2014-06-01 02:10:00
37599 28160221 2014-06-01 00:12:00 2014-06-01 02:19:00
37600 28158625 2014-06-01 00:10:00 2014-06-01 02:31:00
37601 28161077 2014-06-01 00:09:00 2014-06-01 03:14:00
37602 28157263 2014-06-01 00:09:00 2014-06-01 03:05:00
37603 28159956 2014-06-01 00:09:00 2014-06-01 01:04:00
37604 28162132 2014-06-01 00:06:00 2014-06-01 01:20:00
37605 28159435 2014-06-01 00:06:00 2014-06-01 01:41:00
37606 28162516 2014-06-01 00:05:00 2014-06-01 14:07:00
37607 28157374 2014-06-01 00:03:00 2014-06-01 03:15:00
37608 28159445 2014-06-01 00:02:00 2014-06-01 01:44:00
37609 28156952 2014-06-01 00:02:00 2014-06-01 01:14:00
37610 28161969 2014-06-01 00:02:00 2014-06-01 10:26:00
37611 28157261 2014-06-01 00:02:00 2014-06-01 02:26:00
37612 28162458 2014-06-01 00:01:00 2014-06-01 04:39:00
37613 28162216 2014-06-01 00:00:00 2014-06-01 02:14:00
37614 28162314 2014-06-01 00:00:00 2014-06-01 07:38:00

37615 rows × 3 columns


In [32]:
selection['open'] = selection['closed'] - selection['created']


/Users/gcg/.virtualenvs/ddj/lib/python3.5/site-packages/ipykernel/__main__.py:1: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  if __name__ == '__main__':

In [34]:
selection['open']


Out[34]:
0       03:53:00
1       06:21:00
2       01:35:00
3       03:01:00
4       01:19:00
5       03:06:00
6       01:04:00
7       04:18:00
8       04:48:00
9       03:25:00
10      04:52:00
11      02:36:00
12      03:54:00
13      05:13:00
14      03:06:00
15      01:00:00
16      03:27:00
17      13:32:00
18      01:45:00
19      02:48:00
20      05:54:00
21      00:07:00
22      00:33:00
23      02:51:00
24      05:27:00
25      00:21:00
26      02:12:00
27      02:46:00
28      02:56:00
29      05:13:00
          ...   
37585   03:02:00
37586   04:14:00
37587   01:51:00
37588   04:24:00
37589   00:42:00
37590   06:16:00
37591   01:51:00
37592   00:39:00
37593   04:47:00
37594   00:47:00
37595   00:50:00
37596   01:58:00
37597   01:28:00
37598   01:57:00
37599   02:07:00
37600   02:21:00
37601   03:05:00
37602   02:56:00
37603   00:55:00
37604   01:14:00
37605   01:35:00
37606   14:02:00
37607   03:12:00
37608   01:42:00
37609   01:12:00
37610   10:24:00
37611   02:24:00
37612   04:38:00
37613   02:14:00
37614   07:38:00
Name: open, dtype: timedelta64[ns]

In [35]:
selection['open'].mean()


Out[35]:
Timedelta('0 days 07:44:22.532500')

In [36]:
selection['open'].median()


Out[36]:
Timedelta('0 days 02:02:00')

In [37]:
range_time_open = max(selection['open']) - min(selection['open'])

In [38]:
range_time_open


Out[38]:
Timedelta('48 days 05:44:00')

In [ ]: