Weekend shootings and homicides?

How many people were shot each weekend? How many people were killed in a homicide? Which weekends had the most of both types of violence?

For this analysis, we define a weekend as starting on Friday at 3 p.m. and ending on Monday at 6 a.m.

Load data from Newsroom DB


In [22]:
import os
import requests

# Some constants
NEWSROOMDB_URL = os.environ['NEWSROOMDB_URL']

# Utilities for loading data from NewsroomDB

def get_table_url(table_name, base_url=NEWSROOMDB_URL):
    return '{}table/json/{}'.format(base_url, table_name)

def get_table_data(table_name):
    url = get_table_url(table_name)
    
    try:
        r = requests.get(url)
        return r.json()
    except:
        print("Request failed. Probably because the response is huge.  We should fix this.")
        return get_table_data(table_name)

shooting_victims_raw = get_table_data('shootings')
print("Loaded {} shooting victims".format(len(shooting_victims_raw)))


Loaded 12675 shooting victims

In [23]:
import agate
from datetime import datetime, timedelta

# Load raw data into an Agate table

# Agate tries to parse the date and time automatically. It parses the time incorrectly
# as MM:SS instead of HH:MM. We ultimately need a timestamp, which is easily
# parsed by concatenating the date and time, so disable the initial
# auto-parsing of these fields.
column_types = {
    'Date': agate.Text(),
    'Time': agate.Text(),
}
shooting_victims = agate.Table.from_object(shooting_victims_raw, column_types=column_types)

# Calculate a timestamp from the Date and Time columns

def get_timestamp(row, date_col='Date', time_col='Time'):    
    if not row[date_col] or not row[time_col]:
        return None
    
    try:
        timestamp = datetime.strptime("{} {}".format(row[date_col], row[time_col]), "%Y-%m-%d %H:%M")
    except ValueError:
        timestamp = datetime.strptime("{} {}".format(row[date_col], row[time_col]), "%Y-%m-%d %H:%M:%S")
    
    # HACK: There are some bad dates in the data.  Based on visual inspection,
    # we can fix the dates using a couple of rules
    year = timestamp.year
    if year < 20:
        year += 2000
        new_timestamp = timestamp.replace(year=year)
        print("Bad year date in row with id {}. Changing {} to {}.".format(
            row['_id'], timestamp.strftime("%Y-%m-%d"), new_timestamp.strftime("%Y-%m-%d")))
        timestamp = new_timestamp
    elif year == 216:
        new_timestamp = timestamp.replace(year=2016)
        print("Bad year date in row with id {}. Changing {} to {}.".format(
            row['_id'], timestamp.strftime("%Y-%m-%d"), new_timestamp.strftime("%Y-%m-%d")))
        timestamp = new_timestamp
    
    return timestamp

shooting_victims = shooting_victims.compute([
    ('timestamp', agate.Formula(agate.DateTime(), get_timestamp))
])

shooting_victims = shooting_victims.where(lambda row: row['timestamp'] is not None)


Bad year date in row with id 53b6a23cdb573e256fa3b14c. Changing 0014-07-22 to 2014-07-22.
Bad year date in row with id 5707a7f8389ce82a2bd86eed. Changing 0016-04-02 to 2016-04-02.
Bad year date in row with id 57419172db573e070ae4c812. Changing 0016-05-20 to 2016-05-20.
Bad year date in row with id 5756b0e7389ce82a2bd8717e. Changing 0216-06-07 to 2016-06-07.
Bad year date in row with id 575fde1c389ce82a2bd871c7. Changing 0016-06-13 to 2016-06-13.
Bad year date in row with id 576a820f389ce82a2a5b0cc9. Changing 0216-06-21 to 2016-06-21.

Filter to only weekend shootings


In [24]:
def is_weekend(timestamp):
    """Does the timestamp fall between Friday 3 p.m. and Monday 6 a.m."""
    if not timestamp:
        return False
    
    day_of_week = timestamp.weekday()
    
    if day_of_week > 0 and day_of_week < 4:
        return False
    
    if day_of_week == 4:
        # Friday
        
        # Same day, 3 p.m.
        start = datetime(timestamp.year, timestamp.month, timestamp.day, 15)
        
        return timestamp >= start
    
    if day_of_week == 0:
        # Monday
        
        # Same day, 6 a.m.
        end = datetime(timestamp.year, timestamp.month, timestamp.day, 6)
        
        return timestamp < end
        
    return True

weekend_shootings = shooting_victims.where(lambda row: is_weekend(row['timestamp']))
print("There are {0} weekend shooting victims".format(len(weekend_shootings.rows)))


There are 6230 weekend shooting victims

In [25]:
from datetime import datetime
import time

# Utility functions for calculating weekend start and end dates/times for a given 

def clone_datetime(d):
    """Make a copy of a datetime object"""
    # HACK: Is there a better way to do this?  Why isn't there an obvious clone method?
    return datetime.fromtimestamp(time.mktime(d.timetuple()))

# The following methods only work for timestamps that fall within a weekend

def weekend_start(timestamp):
    days_from_friday = timestamp.weekday() - 4
    
    if days_from_friday < 0:
        days_from_friday += 1
        days_from_friday *= -1
        
    friday_delta = timedelta(days=(-1 * days_from_friday))
    
    start = clone_datetime(timestamp)
    
    start += friday_delta
    start = start.replace(hour=15, minute=0, second=0)
    
    return start

def weekend_end(timestamp):
    days_to_monday = 0 - timestamp.weekday()
    
    if days_to_monday < 0:
        days_to_monday += 7
        
    monday_delta = timedelta(days=days_to_monday)
    
    end = clone_datetime(timestamp)
    
    end += monday_delta
    end = end.replace(hour=6, minute=0, second=0)
    
    return end

def get_weekend_start(row):
    return weekend_start(row['timestamp']).date()

In [26]:
# Add weekend start and end dates to each row so we can
# group by on them later.  Cecilia took a different approach,
# calculating the weekends first and iterating through them
# and finding matching shootings for each weekend.
weekend_shootings_with_start_end = weekend_shootings.compute([
    ('weekend_start', agate.Formula(agate.Date(), get_weekend_start)),
    ('weekend_end', agate.Formula(agate.Date(), lambda row: weekend_end(row['timestamp']).date()))
])

In [27]:
# Aggregate the shooting victims by weekend
shooting_victims_by_weekend = weekend_shootings_with_start_end.group_by(
    lambda row: row['weekend_start'].strftime("%Y-%m-%d") + " to " +  row['weekend_end'].strftime("%Y-%m-%d"))

shooting_victims_weekend_counts = shooting_victims_by_weekend.aggregate([
    ('count', agate.Count())
])

shooting_victims_weekend_counts.order_by('count', reverse=True).print_table(max_column_width=40, max_rows=None)


|---------------------------+--------|
|  group                    | count  |
|---------------------------+--------|
|  2014-07-04 to 2014-07-07 |    67  |
|  2012-06-08 to 2012-06-11 |    59  |
|  2016-06-17 to 2016-06-20 |    59  |
|  2015-07-03 to 2015-07-06 |    57  |
|  2016-06-24 to 2016-06-27 |    56  |
|  2015-09-25 to 2015-09-28 |    56  |
|  2012-03-16 to 2012-03-19 |    55  |
|  2015-09-18 to 2015-09-21 |    54  |
|  2013-06-14 to 2013-06-17 |    53  |
|  2016-05-06 to 2016-05-09 |    51  |
|  2016-05-27 to 2016-05-30 |    50  |
|  2015-08-07 to 2015-08-10 |    48  |
|  2014-07-18 to 2014-07-21 |    46  |
|  2014-08-22 to 2014-08-25 |    46  |
|  2015-05-15 to 2015-05-18 |    46  |
|  2014-04-18 to 2014-04-21 |    45  |
|  2016-06-10 to 2016-06-13 |    45  |
|  2012-06-15 to 2012-06-18 |    44  |
|  2012-08-24 to 2012-08-27 |    44  |
|  2016-04-22 to 2016-04-25 |    44  |
|  2016-05-20 to 2016-05-23 |    44  |
|  2012-05-25 to 2012-05-28 |    43  |
|  2014-09-26 to 2014-09-29 |    43  |
|  2015-08-21 to 2015-08-24 |    43  |
|  2012-11-30 to 2012-12-03 |    42  |
|  2014-06-27 to 2014-06-30 |    42  |
|  2015-07-31 to 2015-08-03 |    42  |
|  2013-08-16 to 2013-08-19 |    41  |
|  2015-05-22 to 2015-05-25 |    41  |
|  2015-07-24 to 2015-07-27 |    41  |
|  2014-04-11 to 2014-04-14 |    40  |
|  2014-04-25 to 2014-04-28 |    40  |
|  2015-08-14 to 2015-08-17 |    40  |
|  2014-10-24 to 2014-10-27 |    39  |
|  2015-06-05 to 2015-06-08 |    39  |
|  2015-09-04 to 2015-09-07 |    39  |
|  2016-03-25 to 2016-03-28 |    39  |
|  2016-06-03 to 2016-06-06 |    39  |
|  2012-08-17 to 2012-08-20 |    38  |
|  2014-05-30 to 2014-06-02 |    38  |
|  2014-08-29 to 2014-09-01 |    38  |
|  2015-07-17 to 2015-07-20 |    38  |
|  2013-08-09 to 2013-08-12 |    37  |
|  2015-06-19 to 2015-06-22 |    37  |
|  2016-01-08 to 2016-01-11 |    37  |
|  2012-06-01 to 2012-06-04 |    36  |
|  2013-06-21 to 2013-06-24 |    36  |
|  2011-12-02 to 2011-12-05 |    35  |
|  2015-05-01 to 2015-05-04 |    35  |
|  2015-08-28 to 2015-08-31 |    35  |
|  2016-02-19 to 2016-02-22 |    35  |
|  2015-10-23 to 2015-10-26 |    35  |
|  2016-04-01 to 2016-04-04 |    35  |
|  2012-07-20 to 2012-07-23 |    34  |
|  2014-07-11 to 2014-07-14 |    34  |
|  2014-08-15 to 2014-08-18 |    34  |
|  2014-12-12 to 2014-12-15 |    34  |
|  2015-04-17 to 2015-04-20 |    34  |
|  2016-03-18 to 2016-03-21 |    34  |
|  2011-10-07 to 2011-10-10 |    33  |
|  2012-10-12 to 2012-10-15 |    33  |
|  2014-06-13 to 2014-06-16 |    33  |
|  2015-07-10 to 2015-07-13 |    33  |
|  2015-09-11 to 2015-09-14 |    33  |
|  2012-08-03 to 2012-08-06 |    32  |
|  2014-10-03 to 2014-10-06 |    32  |
|  2014-09-19 to 2014-09-22 |    32  |
|  2015-03-13 to 2015-03-16 |    32  |
|  2015-12-11 to 2015-12-14 |    32  |
|  2012-03-09 to 2012-03-12 |    31  |
|  2012-06-22 to 2012-06-25 |    31  |
|  2012-04-06 to 2012-04-09 |    31  |
|  2015-10-30 to 2015-11-02 |    31  |
|  2016-04-15 to 2016-04-18 |    31  |
|  2013-03-29 to 2013-04-01 |    30  |
|  2013-07-05 to 2013-07-08 |    30  |
|  2013-07-19 to 2013-07-22 |    30  |
|  2014-06-20 to 2014-06-23 |    30  |
|  2015-05-29 to 2015-06-01 |    30  |
|  2016-01-29 to 2016-02-01 |    30  |
|  2016-01-15 to 2016-01-18 |    30  |
|  2016-04-29 to 2016-05-02 |    30  |
|  2012-08-31 to 2012-09-03 |    29  |
|  2014-05-16 to 2014-05-19 |    29  |
|  2014-07-25 to 2014-07-28 |    29  |
|  2014-08-01 to 2014-08-04 |    29  |
|  2014-12-19 to 2014-12-22 |    29  |
|  2015-06-12 to 2015-06-15 |    29  |
|  2012-06-29 to 2012-07-02 |    28  |
|  2012-10-19 to 2012-10-22 |    28  |
|  2012-11-09 to 2012-11-12 |    28  |
|  2014-05-02 to 2014-05-05 |    28  |
|  2014-06-06 to 2014-06-09 |    28  |
|  2015-05-08 to 2015-05-11 |    28  |
|  2016-01-01 to 2016-01-04 |    28  |
|  2016-03-11 to 2016-03-14 |    28  |
|  2012-05-11 to 2012-05-14 |    27  |
|  2012-05-18 to 2012-05-21 |    27  |
|  2013-04-12 to 2013-04-15 |    27  |
|  2013-05-17 to 2013-05-20 |    27  |
|  2013-06-28 to 2013-07-01 |    27  |
|  2015-04-10 to 2015-04-13 |    27  |
|  2012-02-17 to 2012-02-20 |    27  |
|  2014-04-04 to 2014-04-07 |    27  |
|  2014-08-08 to 2014-08-11 |    27  |
|  2015-06-26 to 2015-06-29 |    27  |
|  2013-05-24 to 2013-05-27 |    26  |
|  2015-01-23 to 2015-01-26 |    26  |
|  2016-02-05 to 2016-02-08 |    26  |
|  2016-02-26 to 2016-02-29 |    26  |
|  2012-11-16 to 2012-11-19 |    25  |
|  2013-08-02 to 2013-08-05 |    25  |
|  2013-09-20 to 2013-09-23 |    25  |
|  2014-09-05 to 2014-09-08 |    25  |
|  2015-04-24 to 2015-04-27 |    25  |
|  2016-05-13 to 2016-05-16 |    25  |
|  2015-12-04 to 2015-12-07 |    25  |
|  2012-04-13 to 2012-04-16 |    24  |
|  2012-07-06 to 2012-07-09 |    24  |
|  2012-10-26 to 2012-10-29 |    24  |
|  2014-05-09 to 2014-05-12 |    24  |
|  2014-12-05 to 2014-12-08 |    24  |
|  2014-12-26 to 2014-12-29 |    24  |
|  2012-05-04 to 2012-05-07 |    23  |
|  2012-08-10 to 2012-08-13 |    23  |
|  2015-10-16 to 2015-10-19 |    23  |
|  2015-12-18 to 2015-12-21 |    23  |
|  2011-12-09 to 2011-12-12 |    22  |
|  2012-03-23 to 2012-03-26 |    22  |
|  2013-01-04 to 2013-01-07 |    22  |
|  2013-07-26 to 2013-07-29 |    22  |
|  2014-10-17 to 2014-10-20 |    22  |
|  2015-03-06 to 2015-03-09 |    22  |
|  2015-03-20 to 2015-03-23 |    22  |
|  2011-10-28 to 2011-10-31 |    21  |
|  2013-01-18 to 2013-01-21 |    21  |
|  2013-06-07 to 2013-06-10 |    21  |
|  2013-07-12 to 2013-07-15 |    21  |
|  2013-12-27 to 2013-12-30 |    21  |
|  2014-11-14 to 2014-11-17 |    21  |
|  2015-10-09 to 2015-10-12 |    21  |
|  2016-01-22 to 2016-01-25 |    21  |
|  2012-01-27 to 2012-01-30 |    20  |
|  2012-03-02 to 2012-03-05 |    20  |
|  2012-04-27 to 2012-04-30 |    20  |
|  2013-08-30 to 2013-09-02 |    20  |
|  2013-09-06 to 2013-09-09 |    20  |
|  2013-11-15 to 2013-11-18 |    20  |
|  2013-12-13 to 2013-12-16 |    20  |
|  2011-10-21 to 2011-10-24 |    20  |
|  2014-05-23 to 2014-05-26 |    20  |
|  2014-10-10 to 2014-10-13 |    20  |
|  2015-12-25 to 2015-12-28 |    20  |
|  2016-02-12 to 2016-02-15 |    20  |
|  2011-12-30 to 2012-01-02 |    19  |
|  2012-07-13 to 2012-07-16 |    19  |
|  2012-12-14 to 2012-12-17 |    19  |
|  2013-08-23 to 2013-08-26 |    19  |
|  2013-09-27 to 2013-09-30 |    19  |
|  2014-03-21 to 2014-03-24 |    19  |
|  2015-04-03 to 2015-04-06 |    19  |
|  2015-11-06 to 2015-11-09 |    19  |
|  2012-01-06 to 2012-01-09 |    18  |
|  2012-10-05 to 2012-10-08 |    18  |
|  2013-04-26 to 2013-04-29 |    18  |
|  2013-12-20 to 2013-12-23 |    18  |
|  2014-11-21 to 2014-11-24 |    18  |
|  2015-11-13 to 2015-11-16 |    18  |
|  2012-01-20 to 2012-01-23 |    17  |
|  2012-12-07 to 2012-12-10 |    17  |
|  2013-05-31 to 2013-06-03 |    17  |
|  2013-10-25 to 2013-10-28 |    17  |
|  2014-09-12 to 2014-09-15 |    17  |
|  2014-10-31 to 2014-11-03 |    17  |
|  2015-01-16 to 2015-01-19 |    17  |
|  2015-11-27 to 2015-11-30 |    17  |
|  2012-07-27 to 2012-07-30 |    16  |
|  2012-09-21 to 2012-09-24 |    16  |
|  2012-11-23 to 2012-11-26 |    16  |
|  2013-09-13 to 2013-09-16 |    16  |
|  2013-11-22 to 2013-11-25 |    16  |
|  2013-12-06 to 2013-12-09 |    16  |
|  2014-01-24 to 2014-01-27 |    16  |
|  2011-11-18 to 2011-11-21 |    16  |
|  2012-04-20 to 2012-04-23 |    16  |
|  2014-11-07 to 2014-11-10 |    16  |
|  2015-01-02 to 2015-01-05 |    16  |
|  2016-04-08 to 2016-04-11 |    16  |
|  2016-03-04 to 2016-03-07 |    16  |
|  2011-12-16 to 2011-12-19 |    15  |
|  2012-03-30 to 2012-04-02 |    15  |
|  2012-09-28 to 2012-10-01 |    15  |
|  2012-11-02 to 2012-11-05 |    15  |
|  2013-01-25 to 2013-01-28 |    15  |
|  2013-04-19 to 2013-04-22 |    15  |
|  2013-10-04 to 2013-10-07 |    15  |
|  2014-01-17 to 2014-01-20 |    15  |
|  2011-11-04 to 2011-11-07 |    15  |
|  2014-03-28 to 2014-03-31 |    15  |
|  2015-03-27 to 2015-03-30 |    15  |
|  2013-01-11 to 2013-01-14 |    14  |
|  2013-03-15 to 2013-03-18 |    14  |
|  2013-04-05 to 2013-04-08 |    14  |
|  2013-05-10 to 2013-05-13 |    14  |
|  2013-11-01 to 2013-11-04 |    14  |
|  2013-11-08 to 2013-11-11 |    14  |
|  2014-11-28 to 2014-12-01 |    14  |
|  2012-12-21 to 2012-12-24 |    13  |
|  2013-03-22 to 2013-03-25 |    13  |
|  2012-02-24 to 2012-02-27 |    13  |
|  2014-03-07 to 2014-03-10 |    13  |
|  2015-02-20 to 2015-02-23 |    13  |
|  2015-10-02 to 2015-10-05 |    13  |
|  2012-09-07 to 2012-09-10 |    12  |
|  2013-02-15 to 2013-02-18 |    12  |
|  2013-02-22 to 2013-02-25 |    12  |
|  2013-10-18 to 2013-10-21 |    12  |
|  2014-01-31 to 2014-02-03 |    12  |
|  2014-02-21 to 2014-02-24 |    12  |
|  2011-12-23 to 2011-12-26 |    10  |
|  2012-01-13 to 2012-01-16 |    10  |
|  2012-12-28 to 2012-12-31 |    10  |
|  2013-02-01 to 2013-02-04 |    10  |
|  2013-05-03 to 2013-05-06 |    10  |
|  2014-01-03 to 2014-01-06 |    10  |
|  2014-02-07 to 2014-02-10 |    10  |
|  2011-10-14 to 2011-10-17 |    10  |
|  2011-09-23 to 2011-09-26 |     9  |
|  2013-10-11 to 2013-10-14 |     9  |
|  2013-02-08 to 2013-02-11 |     9  |
|  2014-02-28 to 2014-03-03 |     9  |
|  2015-02-06 to 2015-02-09 |     9  |
|  2011-11-11 to 2011-11-14 |     8  |
|  2013-03-01 to 2013-03-04 |     8  |
|  2013-03-08 to 2013-03-11 |     8  |
|  2013-11-29 to 2013-12-02 |     8  |
|  2014-03-14 to 2014-03-17 |     8  |
|  2015-01-30 to 2015-02-02 |     8  |
|  2012-09-14 to 2012-09-17 |     7  |
|  2014-01-10 to 2014-01-13 |     7  |
|  2012-02-10 to 2012-02-13 |     7  |
|  2015-02-13 to 2015-02-16 |     7  |
|  2015-11-20 to 2015-11-23 |     7  |
|  2011-09-30 to 2011-10-03 |     6  |
|  2012-02-03 to 2012-02-06 |     6  |
|  2015-01-09 to 2015-01-12 |     6  |
|  2011-11-25 to 2011-11-28 |     5  |
|  2015-02-27 to 2015-03-02 |     4  |
|  2014-02-14 to 2014-02-17 |     2  |
|---------------------------+--------|

Do the same thing for Homicides


In [28]:
homicides_raw = get_table_data('homicides')

homicide_column_types = {
    'Occ Date': agate.Text(),
    'Occ Time': agate.Text(),
}
homicides = agate.Table.from_object(homicides_raw, column_types=homicide_column_types)
homicides = homicides.compute([
    ('timestamp', agate.Formula(agate.DateTime(), lambda row: get_timestamp(row, date_col='Occ Date', time_col='Occ Time')))
])

weekend_homicides = homicides.where(lambda row: is_weekend(row['timestamp']))
weekend_homicides_with_start_end = weekend_homicides.compute([
    ('weekend_start', agate.Formula(agate.Date(), get_weekend_start)),
    ('weekend_end', agate.Formula(agate.Date(), lambda row: weekend_end(row['timestamp']).date()))
])

In [29]:
homicides_by_weekend = weekend_homicides_with_start_end.group_by(
    lambda row: row['weekend_start'].strftime("%Y-%m-%d") + " to " +  row['weekend_end'].strftime("%Y-%m-%d"))

weekend_homicide_counts = homicides_by_weekend.aggregate([
    ('count', agate.Count())
])

weekend_homicide_counts.order_by('count', reverse=True).print_table(max_column_width=40, max_rows=None)


|---------------------------+--------|
|  group                    | count  |
|---------------------------+--------|
|  2016-06-17 to 2016-06-20 |    13  |
|  2013-06-14 to 2013-06-17 |    11  |
|  2014-07-04 to 2014-07-07 |    11  |
|  2013-08-16 to 2013-08-19 |    10  |
|  2015-09-18 to 2015-09-21 |    10  |
|  2014-09-05 to 2014-09-08 |     9  |
|  2016-05-06 to 2016-05-09 |     9  |
|  2014-04-18 to 2014-04-21 |     9  |
|  2014-05-30 to 2014-06-02 |     9  |
|  2015-05-22 to 2015-05-25 |     9  |
|  2015-07-03 to 2015-07-06 |     9  |
|  2016-01-29 to 2016-02-01 |     9  |
|  2014-08-29 to 2014-09-01 |     8  |
|  2014-11-07 to 2014-11-10 |     8  |
|  2016-05-13 to 2016-05-16 |     8  |
|  2016-06-03 to 2016-06-06 |     8  |
|  2014-09-26 to 2014-09-29 |     8  |
|  2015-05-29 to 2015-06-01 |     8  |
|  2015-07-10 to 2015-07-13 |     8  |
|  2016-06-24 to 2016-06-27 |     8  |
|  2013-01-25 to 2013-01-28 |     7  |
|  2016-06-10 to 2016-06-13 |     7  |
|  2015-10-23 to 2015-10-26 |     7  |
|  2013-05-17 to 2013-05-20 |     7  |
|  2013-07-19 to 2013-07-22 |     7  |
|  2016-02-12 to 2016-02-15 |     7  |
|  2014-04-25 to 2014-04-28 |     7  |
|  2014-05-16 to 2014-05-19 |     7  |
|  2014-08-01 to 2014-08-04 |     7  |
|  2015-07-24 to 2015-07-27 |     7  |
|  2015-08-21 to 2015-08-24 |     7  |
|  2016-01-08 to 2016-01-11 |     7  |
|  2013-01-04 to 2013-01-07 |     6  |
|  2013-06-21 to 2013-06-24 |     6  |
|  2013-05-24 to 2013-05-27 |     6  |
|  2013-08-30 to 2013-09-02 |     6  |
|  2014-08-15 to 2014-08-18 |     6  |
|  2014-08-22 to 2014-08-25 |     6  |
|  2015-09-04 to 2015-09-07 |     6  |
|  2016-04-22 to 2016-04-25 |     6  |
|  2016-04-29 to 2016-05-02 |     6  |
|  2013-09-20 to 2013-09-23 |     6  |
|  2014-06-20 to 2014-06-23 |     6  |
|  2015-03-13 to 2015-03-16 |     6  |
|  2015-07-17 to 2015-07-20 |     6  |
|  2015-08-14 to 2015-08-17 |     6  |
|  2015-11-27 to 2015-11-30 |     6  |
|  2014-09-19 to 2014-09-22 |     5  |
|  2015-11-20 to 2015-11-23 |     5  |
|  2013-03-15 to 2013-03-18 |     5  |
|  2013-05-10 to 2013-05-13 |     5  |
|  2015-03-06 to 2015-03-09 |     5  |
|  2016-01-22 to 2016-01-25 |     5  |
|  2016-03-11 to 2016-03-14 |     5  |
|  2016-05-20 to 2016-05-23 |     5  |
|  2013-07-12 to 2013-07-15 |     5  |
|  2013-12-20 to 2013-12-23 |     5  |
|  2013-11-01 to 2013-11-04 |     5  |
|  2014-04-11 to 2014-04-14 |     5  |
|  2014-05-02 to 2014-05-05 |     5  |
|  2014-07-11 to 2014-07-14 |     5  |
|  2014-07-18 to 2014-07-21 |     5  |
|  2014-11-14 to 2014-11-17 |     5  |
|  2014-11-28 to 2014-12-01 |     5  |
|  2014-12-26 to 2014-12-29 |     5  |
|  2015-01-23 to 2015-01-26 |     5  |
|  2015-04-17 to 2015-04-20 |     5  |
|  2015-05-01 to 2015-05-04 |     5  |
|  2015-06-05 to 2015-06-08 |     5  |
|  2015-06-12 to 2015-06-15 |     5  |
|  2015-06-26 to 2015-06-29 |     5  |
|  2015-08-28 to 2015-08-31 |     5  |
|  2016-02-19 to 2016-02-22 |     5  |
|  2016-05-27 to 2016-05-30 |     5  |
|  2015-11-06 to 2015-11-09 |     4  |
|  2013-04-19 to 2013-04-22 |     4  |
|  2013-09-06 to 2013-09-09 |     4  |
|  2014-01-17 to 2014-01-20 |     4  |
|  2013-01-11 to 2013-01-14 |     4  |
|  2013-04-12 to 2013-04-15 |     4  |
|  2013-08-09 to 2013-08-12 |     4  |
|  2013-10-04 to 2013-10-07 |     4  |
|  2014-03-21 to 2014-03-24 |     4  |
|  2014-05-09 to 2014-05-12 |     4  |
|  2014-09-12 to 2014-09-15 |     4  |
|  2014-10-03 to 2014-10-06 |     4  |
|  2014-05-23 to 2014-05-26 |     4  |
|  2014-10-24 to 2014-10-27 |     4  |
|  2014-10-31 to 2014-11-03 |     4  |
|  2015-01-16 to 2015-01-19 |     4  |
|  2015-01-30 to 2015-02-02 |     4  |
|  2015-03-20 to 2015-03-23 |     4  |
|  2015-07-31 to 2015-08-03 |     4  |
|  2015-12-04 to 2015-12-07 |     4  |
|  2015-12-18 to 2015-12-21 |     4  |
|  2015-12-25 to 2015-12-28 |     4  |
|  2016-01-15 to 2016-01-18 |     4  |
|  2016-02-05 to 2016-02-08 |     4  |
|  2015-06-19 to 2015-06-22 |     4  |
|  2015-09-25 to 2015-09-28 |     4  |
|  2015-10-09 to 2015-10-12 |     4  |
|  2013-01-18 to 2013-01-21 |     3  |
|  2014-10-17 to 2014-10-20 |     3  |
|  2015-10-16 to 2015-10-19 |     3  |
|  2013-06-07 to 2013-06-10 |     3  |
|  2015-10-30 to 2015-11-02 |     3  |
|  2016-04-08 to 2016-04-11 |     3  |
|  2013-10-25 to 2013-10-28 |     3  |
|  2013-11-22 to 2013-11-25 |     3  |
|  2013-12-06 to 2013-12-09 |     3  |
|  2013-05-31 to 2013-06-03 |     3  |
|  2013-07-05 to 2013-07-08 |     3  |
|  2013-08-02 to 2013-08-05 |     3  |
|  2013-09-27 to 2013-09-30 |     3  |
|  2014-01-24 to 2014-01-27 |     3  |
|  2014-02-28 to 2014-03-03 |     3  |
|  2014-06-06 to 2014-06-09 |     3  |
|  2014-06-13 to 2014-06-16 |     3  |
|  2014-10-10 to 2014-10-13 |     3  |
|  2014-11-21 to 2014-11-24 |     3  |
|  2014-12-19 to 2014-12-22 |     3  |
|  2013-08-23 to 2013-08-26 |     3  |
|  2015-02-20 to 2015-02-23 |     3  |
|  2015-03-27 to 2015-03-30 |     3  |
|  2015-04-24 to 2015-04-27 |     3  |
|  2015-05-08 to 2015-05-11 |     3  |
|  2015-08-07 to 2015-08-10 |     3  |
|  2015-09-11 to 2015-09-14 |     3  |
|  2016-03-18 to 2016-03-21 |     3  |
|  2016-04-15 to 2016-04-18 |     3  |
|  2013-02-22 to 2013-02-25 |     2  |
|  2013-02-01 to 2013-02-04 |     2  |
|  2013-06-28 to 2013-07-01 |     2  |
|  2015-10-02 to 2015-10-05 |     2  |
|  2013-03-22 to 2013-03-25 |     2  |
|  2013-03-29 to 2013-04-01 |     2  |
|  2013-07-26 to 2013-07-29 |     2  |
|  2013-02-15 to 2013-02-18 |     2  |
|  2013-09-13 to 2013-09-16 |     2  |
|  2013-12-13 to 2013-12-16 |     2  |
|  2014-01-31 to 2014-02-03 |     2  |
|  2014-02-21 to 2014-02-24 |     2  |
|  2014-06-27 to 2014-06-30 |     2  |
|  2014-02-07 to 2014-02-10 |     2  |
|  2014-04-04 to 2014-04-07 |     2  |
|  2014-12-12 to 2014-12-15 |     2  |
|  2014-12-05 to 2014-12-08 |     2  |
|  2015-01-02 to 2015-01-05 |     2  |
|  2015-02-06 to 2015-02-09 |     2  |
|  2015-04-03 to 2015-04-06 |     2  |
|  2015-05-15 to 2015-05-18 |     2  |
|  2013-11-29 to 2013-12-02 |     2  |
|  2013-12-27 to 2013-12-30 |     2  |
|  2013-11-15 to 2013-11-18 |     2  |
|  2015-02-13 to 2015-02-16 |     2  |
|  2015-04-10 to 2015-04-13 |     2  |
|  2015-12-11 to 2015-12-14 |     2  |
|  2016-01-01 to 2016-01-04 |     2  |
|  2016-04-01 to 2016-04-04 |     2  |
|  2013-03-01 to 2013-03-04 |     1  |
|  2013-05-03 to 2013-05-06 |     1  |
|  2016-03-25 to 2016-03-28 |     1  |
|  1993-07-23 to 1993-07-26 |     1  |
|  2013-04-26 to 2013-04-29 |     1  |
|  2013-10-11 to 2013-10-14 |     1  |
|  2003-08-01 to 2003-08-04 |     1  |
|  2014-03-14 to 2014-03-17 |     1  |
|  2014-07-25 to 2014-07-28 |     1  |
|  2014-08-08 to 2014-08-11 |     1  |
|  2012-12-21 to 2012-12-24 |     1  |
|  2015-11-13 to 2015-11-16 |     1  |
|  2015-01-09 to 2015-01-12 |     1  |
|  2013-04-05 to 2013-04-08 |     1  |
|  2010-06-04 to 2010-06-07 |     1  |
|  2014-01-03 to 2014-01-06 |     1  |
|  2014-01-10 to 2014-01-13 |     1  |
|  2016-02-26 to 2016-02-29 |     1  |
|  2016-03-04 to 2016-03-07 |     1  |
|---------------------------+--------|

What about both?


In [30]:
import re

# First off, we need to avoid double-counting homicides and shootings
def is_homicide(row):
    if not row['UCR']:
        return False
    
    if re.match(r'0{0,1}110', row['UCR']):
        return True
    
    return False

non_homicide_weekend_shootings = weekend_shootings_with_start_end.where(lambda row: not is_homicide(row))
print("There are {0} non-homicide weekend shootings".format(len(non_homicide_weekend_shootings.rows)))

non_homicide_shooting_victims_by_weekend = non_homicide_weekend_shootings.group_by(
    lambda row: row['weekend_start'].strftime("%Y-%m-%d") + " to " +  row['weekend_end'].strftime("%Y-%m-%d"))

non_homicide_shooting_victims_weekend_counts = non_homicide_shooting_victims_by_weekend.aggregate([
    ('count', agate.Count())
])


There are 5322 non-homicide weekend shootings

In [31]:
def none_to_zero(x):
    if x is None:
        return 0
    
    return x

shooting_victims_and_homicides = non_homicide_shooting_victims_weekend_counts.join(weekend_homicide_counts, 'group')
shooting_victims_and_homicides = shooting_victims_and_homicides.compute([
    ('total', agate.Formula(agate.Number(), lambda row: row['count'] + none_to_zero(row['count2']))),
])
shooting_victims_and_homicides.order_by('total', reverse=True).print_table(max_column_width=40, max_rows=None)


|---------------------------+-------+--------+--------|
|  group                    | count | count2 | total  |
|---------------------------+-------+--------+--------|
|  2014-07-04 to 2014-07-07 |    56 |     11 |    67  |
|  2015-07-03 to 2015-07-06 |    51 |      9 |    60  |
|  2016-06-17 to 2016-06-20 |    47 |     13 |    60  |
|  2013-06-14 to 2013-06-17 |    47 |     11 |    58  |
|  2016-06-24 to 2016-06-27 |    48 |      8 |    56  |
|  2015-09-25 to 2015-09-28 |    52 |      4 |    56  |
|  2015-09-18 to 2015-09-21 |    45 |     10 |    55  |
|  2016-05-06 to 2016-05-09 |    43 |      9 |    52  |
|  2016-05-27 to 2016-05-30 |    46 |      5 |    51  |
|  2012-06-08 to 2012-06-11 |    50 |        |    50  |
|  2015-08-07 to 2015-08-10 |    45 |      3 |    48  |
|  2014-09-26 to 2014-09-29 |    39 |      8 |    47  |
|  2015-05-15 to 2015-05-18 |    45 |      2 |    47  |
|  2012-03-16 to 2012-03-19 |    46 |        |    46  |
|  2014-07-18 to 2014-07-21 |    41 |      5 |    46  |
|  2014-08-22 to 2014-08-25 |    40 |      6 |    46  |
|  2014-04-18 to 2014-04-21 |    36 |      9 |    45  |
|  2016-06-10 to 2016-06-13 |    38 |      7 |    45  |
|  2013-08-16 to 2013-08-19 |    34 |     10 |    44  |
|  2016-04-22 to 2016-04-25 |    38 |      6 |    44  |
|  2016-05-20 to 2016-05-23 |    39 |      5 |    44  |
|  2014-04-25 to 2014-04-28 |    36 |      7 |    43  |
|  2014-06-27 to 2014-06-30 |    41 |      2 |    43  |
|  2015-08-21 to 2015-08-24 |    36 |      7 |    43  |
|  2015-07-31 to 2015-08-03 |    38 |      4 |    42  |
|  2014-08-29 to 2014-09-01 |    33 |      8 |    41  |
|  2015-05-22 to 2015-05-25 |    32 |      9 |    41  |
|  2015-07-24 to 2015-07-27 |    34 |      7 |    41  |
|  2014-04-11 to 2014-04-14 |    35 |      5 |    40  |
|  2014-10-24 to 2014-10-27 |    36 |      4 |    40  |
|  2015-07-17 to 2015-07-20 |    34 |      6 |    40  |
|  2015-08-14 to 2015-08-17 |    34 |      6 |    40  |
|  2016-01-08 to 2016-01-11 |    33 |      7 |    40  |
|  2015-06-05 to 2015-06-08 |    34 |      5 |    39  |
|  2016-03-25 to 2016-03-28 |    38 |      1 |    39  |
|  2016-06-03 to 2016-06-06 |    31 |      8 |    39  |
|  2013-06-21 to 2013-06-24 |    32 |      6 |    38  |
|  2015-06-19 to 2015-06-22 |    34 |      4 |    38  |
|  2014-05-30 to 2014-06-02 |    29 |      9 |    38  |
|  2015-09-04 to 2015-09-07 |    32 |      6 |    38  |
|  2012-06-15 to 2012-06-18 |    37 |        |    37  |
|  2013-08-09 to 2013-08-12 |    33 |      4 |    37  |
|  2012-05-25 to 2012-05-28 |    36 |        |    36  |
|  2015-08-28 to 2015-08-31 |    31 |      5 |    36  |
|  2016-02-19 to 2016-02-22 |    31 |      5 |    36  |
|  2015-10-23 to 2015-10-26 |    29 |      7 |    36  |
|  2016-04-01 to 2016-04-04 |    34 |      2 |    36  |
|  2012-08-24 to 2012-08-27 |    35 |        |    35  |
|  2012-11-30 to 2012-12-03 |    35 |        |    35  |
|  2015-04-17 to 2015-04-20 |    30 |      5 |    35  |
|  2015-05-01 to 2015-05-04 |    30 |      5 |    35  |
|  2016-03-18 to 2016-03-21 |    32 |      3 |    35  |
|  2014-06-13 to 2014-06-16 |    31 |      3 |    34  |
|  2014-07-11 to 2014-07-14 |    29 |      5 |    34  |
|  2014-08-15 to 2014-08-18 |    28 |      6 |    34  |
|  2014-09-19 to 2014-09-22 |    29 |      5 |    34  |
|  2015-07-10 to 2015-07-13 |    26 |      8 |    34  |
|  2012-06-01 to 2012-06-04 |    33 |        |    33  |
|  2014-12-12 to 2014-12-15 |    31 |      2 |    33  |
|  2015-03-13 to 2015-03-16 |    27 |      6 |    33  |
|  2015-12-11 to 2015-12-14 |    31 |      2 |    33  |
|  2016-01-29 to 2016-02-01 |    24 |      9 |    33  |
|  2014-10-03 to 2014-10-06 |    28 |      4 |    32  |
|  2015-09-11 to 2015-09-14 |    29 |      3 |    32  |
|  2015-10-30 to 2015-11-02 |    29 |      3 |    32  |
|  2016-04-29 to 2016-05-02 |    26 |      6 |    32  |
|  2012-08-17 to 2012-08-20 |    31 |        |    31  |
|  2013-07-19 to 2013-07-22 |    24 |      7 |    31  |
|  2014-05-16 to 2014-05-19 |    24 |      7 |    31  |
|  2014-08-01 to 2014-08-04 |    24 |      7 |    31  |
|  2015-05-29 to 2015-06-01 |    23 |      8 |    31  |
|  2015-06-12 to 2015-06-15 |    26 |      5 |    31  |
|  2016-04-15 to 2016-04-18 |    28 |      3 |    31  |
|  2011-12-02 to 2011-12-05 |    30 |        |    30  |
|  2012-07-20 to 2012-07-23 |    30 |        |    30  |
|  2013-03-29 to 2013-04-01 |    28 |      2 |    30  |
|  2013-07-05 to 2013-07-08 |    27 |      3 |    30  |
|  2014-05-02 to 2014-05-05 |    25 |      5 |    30  |
|  2014-06-20 to 2014-06-23 |    24 |      6 |    30  |
|  2011-10-07 to 2011-10-10 |    29 |        |    29  |
|  2014-07-25 to 2014-07-28 |    28 |      1 |    29  |
|  2014-12-19 to 2014-12-22 |    26 |      3 |    29  |
|  2016-01-15 to 2016-01-18 |    25 |      4 |    29  |
|  2012-03-09 to 2012-03-12 |    28 |        |    28  |
|  2012-08-03 to 2012-08-06 |    28 |        |    28  |
|  2014-06-06 to 2014-06-09 |    25 |      3 |    28  |
|  2015-05-08 to 2015-05-11 |    25 |      3 |    28  |
|  2015-06-26 to 2015-06-29 |    23 |      5 |    28  |
|  2016-03-11 to 2016-03-14 |    23 |      5 |    28  |
|  2012-06-22 to 2012-06-25 |    27 |        |    27  |
|  2012-10-12 to 2012-10-15 |    27 |        |    27  |
|  2013-04-12 to 2013-04-15 |    23 |      4 |    27  |
|  2013-05-17 to 2013-05-20 |    20 |      7 |    27  |
|  2013-05-24 to 2013-05-27 |    21 |      6 |    27  |
|  2013-06-28 to 2013-07-01 |    25 |      2 |    27  |
|  2015-04-10 to 2015-04-13 |    25 |      2 |    27  |
|  2014-04-04 to 2014-04-07 |    25 |      2 |    27  |
|  2014-08-08 to 2014-08-11 |    26 |      1 |    27  |
|  2014-09-05 to 2014-09-08 |    18 |      9 |    27  |
|  2016-01-01 to 2016-01-04 |    25 |      2 |    27  |
|  2016-02-05 to 2016-02-08 |    23 |      4 |    27  |
|  2012-08-31 to 2012-09-03 |    26 |        |    26  |
|  2012-11-09 to 2012-11-12 |    26 |        |    26  |
|  2012-04-06 to 2012-04-09 |    26 |        |    26  |
|  2015-01-23 to 2015-01-26 |    21 |      5 |    26  |
|  2013-08-02 to 2013-08-05 |    22 |      3 |    25  |
|  2013-09-20 to 2013-09-23 |    19 |      6 |    25  |
|  2014-12-26 to 2014-12-29 |    20 |      5 |    25  |
|  2015-04-24 to 2015-04-27 |    22 |      3 |    25  |
|  2016-05-13 to 2016-05-16 |    17 |      8 |    25  |
|  2015-12-04 to 2015-12-07 |    21 |      4 |    25  |
|  2016-02-26 to 2016-02-29 |    24 |      1 |    25  |
|  2013-01-04 to 2013-01-07 |    18 |      6 |    24  |
|  2014-05-09 to 2014-05-12 |    20 |      4 |    24  |
|  2014-12-05 to 2014-12-08 |    22 |      2 |    24  |
|  2015-03-06 to 2015-03-09 |    19 |      5 |    24  |
|  2015-12-18 to 2015-12-21 |    20 |      4 |    24  |
|  2012-07-06 to 2012-07-09 |    23 |        |    23  |
|  2013-06-07 to 2013-06-10 |    20 |      3 |    23  |
|  2013-07-26 to 2013-07-29 |    21 |      2 |    23  |
|  2015-10-16 to 2015-10-19 |    20 |      3 |    23  |
|  2016-01-22 to 2016-01-25 |    18 |      5 |    23  |
|  2013-01-18 to 2013-01-21 |    19 |      3 |    22  |
|  2013-08-30 to 2013-09-02 |    16 |      6 |    22  |
|  2013-09-06 to 2013-09-09 |    18 |      4 |    22  |
|  2014-03-21 to 2014-03-24 |    18 |      4 |    22  |
|  2014-10-17 to 2014-10-20 |    19 |      3 |    22  |
|  2015-03-20 to 2015-03-23 |    18 |      4 |    22  |
|  2012-05-04 to 2012-05-07 |    21 |        |    21  |
|  2012-08-10 to 2012-08-13 |    21 |        |    21  |
|  2012-11-16 to 2012-11-19 |    21 |        |    21  |
|  2013-07-12 to 2013-07-15 |    16 |      5 |    21  |
|  2013-09-27 to 2013-09-30 |    18 |      3 |    21  |
|  2013-11-15 to 2013-11-18 |    19 |      2 |    21  |
|  2013-12-27 to 2013-12-30 |    19 |      2 |    21  |
|  2014-11-14 to 2014-11-17 |    16 |      5 |    21  |
|  2015-10-09 to 2015-10-12 |    17 |      4 |    21  |
|  2016-02-12 to 2016-02-15 |    14 |      7 |    21  |
|  2011-12-09 to 2011-12-12 |    20 |        |    20  |
|  2012-01-27 to 2012-01-30 |    20 |        |    20  |
|  2012-05-18 to 2012-05-21 |    20 |        |    20  |
|  2012-06-29 to 2012-07-02 |    20 |        |    20  |
|  2012-10-19 to 2012-10-22 |    20 |        |    20  |
|  2013-08-23 to 2013-08-26 |    17 |      3 |    20  |
|  2012-02-17 to 2012-02-20 |    20 |        |    20  |
|  2012-05-11 to 2012-05-14 |    20 |        |    20  |
|  2014-05-23 to 2014-05-26 |    16 |      4 |    20  |
|  2014-10-10 to 2014-10-13 |    17 |      3 |    20  |
|  2015-12-25 to 2015-12-28 |    16 |      4 |    20  |
|  2013-12-13 to 2013-12-16 |    17 |      2 |    19  |
|  2013-12-20 to 2013-12-23 |    14 |      5 |    19  |
|  2014-09-12 to 2014-09-15 |    15 |      4 |    19  |
|  2015-04-03 to 2015-04-06 |    17 |      2 |    19  |
|  2015-11-27 to 2015-11-30 |    13 |      6 |    19  |
|  2015-11-06 to 2015-11-09 |    15 |      4 |    19  |
|  2012-10-26 to 2012-10-29 |    18 |        |    18  |
|  2012-12-14 to 2012-12-17 |    18 |        |    18  |
|  2013-04-26 to 2013-04-29 |    17 |      1 |    18  |
|  2013-05-31 to 2013-06-03 |    15 |      3 |    18  |
|  2011-10-21 to 2011-10-24 |    18 |        |    18  |
|  2014-10-31 to 2014-11-03 |    14 |      4 |    18  |
|  2014-11-07 to 2014-11-10 |    10 |      8 |    18  |
|  2014-11-21 to 2014-11-24 |    15 |      3 |    18  |
|  2015-11-13 to 2015-11-16 |    17 |      1 |    18  |
|  2012-03-02 to 2012-03-05 |    17 |        |    17  |
|  2013-03-15 to 2013-03-18 |    12 |      5 |    17  |
|  2013-10-25 to 2013-10-28 |    14 |      3 |    17  |
|  2013-12-06 to 2013-12-09 |    14 |      3 |    17  |
|  2015-01-16 to 2015-01-19 |    13 |      4 |    17  |
|  2012-03-23 to 2012-03-26 |    16 |        |    16  |
|  2012-04-27 to 2012-04-30 |    16 |        |    16  |
|  2011-12-30 to 2012-01-02 |    16 |        |    16  |
|  2012-07-27 to 2012-07-30 |    16 |        |    16  |
|  2013-01-25 to 2013-01-28 |     9 |      7 |    16  |
|  2013-04-19 to 2013-04-22 |    12 |      4 |    16  |
|  2013-09-13 to 2013-09-16 |    14 |      2 |    16  |
|  2013-10-04 to 2013-10-07 |    12 |      4 |    16  |
|  2013-11-22 to 2013-11-25 |    13 |      3 |    16  |
|  2014-01-24 to 2014-01-27 |    13 |      3 |    16  |
|  2011-10-28 to 2011-10-31 |    16 |        |    16  |
|  2015-01-02 to 2015-01-05 |    14 |      2 |    16  |
|  2016-03-04 to 2016-03-07 |    15 |      1 |    16  |
|  2016-04-08 to 2016-04-11 |    13 |      3 |    16  |
|  2012-04-13 to 2012-04-16 |    15 |        |    15  |
|  2012-07-13 to 2012-07-16 |    15 |        |    15  |
|  2012-10-05 to 2012-10-08 |    15 |        |    15  |
|  2012-12-07 to 2012-12-10 |    15 |        |    15  |
|  2013-11-01 to 2013-11-04 |    10 |      5 |    15  |
|  2014-01-17 to 2014-01-20 |    11 |      4 |    15  |
|  2011-11-18 to 2011-11-21 |    15 |        |    15  |
|  2014-03-28 to 2014-03-31 |    15 |        |    15  |
|  2015-03-27 to 2015-03-30 |    12 |      3 |    15  |
|  2011-12-16 to 2011-12-19 |    14 |        |    14  |
|  2012-01-06 to 2012-01-09 |    14 |        |    14  |
|  2012-03-30 to 2012-04-02 |    14 |        |    14  |
|  2012-11-23 to 2012-11-26 |    14 |        |    14  |
|  2013-01-11 to 2013-01-14 |    10 |      4 |    14  |
|  2013-03-22 to 2013-03-25 |    12 |      2 |    14  |
|  2013-04-05 to 2013-04-08 |    13 |      1 |    14  |
|  2013-05-10 to 2013-05-13 |     9 |      5 |    14  |
|  2013-11-08 to 2013-11-11 |    14 |        |    14  |
|  2014-02-21 to 2014-02-24 |    11 |      2 |    13  |
|  2014-03-07 to 2014-03-10 |    13 |        |    13  |
|  2014-11-28 to 2014-12-01 |     8 |      5 |    13  |
|  2015-02-20 to 2015-02-23 |    10 |      3 |    13  |
|  2015-10-02 to 2015-10-05 |    11 |      2 |    13  |
|  2012-01-20 to 2012-01-23 |    12 |        |    12  |
|  2012-09-21 to 2012-09-24 |    12 |        |    12  |
|  2012-09-28 to 2012-10-01 |    12 |        |    12  |
|  2013-02-15 to 2013-02-18 |    10 |      2 |    12  |
|  2013-02-22 to 2013-02-25 |    10 |      2 |    12  |
|  2013-10-18 to 2013-10-21 |    12 |        |    12  |
|  2014-01-31 to 2014-02-03 |    10 |      2 |    12  |
|  2012-04-20 to 2012-04-23 |    12 |        |    12  |
|  2012-11-02 to 2012-11-05 |    11 |        |    11  |
|  2012-12-21 to 2012-12-24 |    10 |      1 |    11  |
|  2013-05-03 to 2013-05-06 |    10 |      1 |    11  |
|  2012-02-24 to 2012-02-27 |    11 |        |    11  |
|  2012-09-07 to 2012-09-10 |    10 |        |    10  |
|  2013-02-01 to 2013-02-04 |     8 |      2 |    10  |
|  2014-01-03 to 2014-01-06 |     9 |      1 |    10  |
|  2014-02-07 to 2014-02-10 |     8 |      2 |    10  |
|  2011-11-04 to 2011-11-07 |    10 |        |    10  |
|  2015-01-30 to 2015-02-02 |     6 |      4 |    10  |
|  2015-02-06 to 2015-02-09 |     8 |      2 |    10  |
|  2015-11-20 to 2015-11-23 |     5 |      5 |    10  |
|  2013-03-01 to 2013-03-04 |     8 |      1 |     9  |
|  2013-10-11 to 2013-10-14 |     8 |      1 |     9  |
|  2013-02-08 to 2013-02-11 |     9 |        |     9  |
|  2011-09-23 to 2011-09-26 |     8 |        |     8  |
|  2012-01-13 to 2012-01-16 |     8 |        |     8  |
|  2012-12-28 to 2012-12-31 |     8 |        |     8  |
|  2013-11-29 to 2013-12-02 |     6 |      2 |     8  |
|  2011-10-14 to 2011-10-17 |     8 |        |     8  |
|  2014-02-28 to 2014-03-03 |     5 |      3 |     8  |
|  2014-03-14 to 2014-03-17 |     7 |      1 |     8  |
|  2015-02-13 to 2015-02-16 |     6 |      2 |     8  |
|  2013-03-08 to 2013-03-11 |     7 |        |     7  |
|  2014-01-10 to 2014-01-13 |     6 |      1 |     7  |
|  2011-11-11 to 2011-11-14 |     6 |        |     6  |
|  2015-01-09 to 2015-01-12 |     5 |      1 |     6  |
|  2011-12-23 to 2011-12-26 |     5 |        |     5  |
|  2011-09-30 to 2011-10-03 |     5 |        |     5  |
|  2012-02-03 to 2012-02-06 |     5 |        |     5  |
|  2012-02-10 to 2012-02-13 |     4 |        |     4  |
|  2015-02-27 to 2015-03-02 |     4 |        |     4  |
|  2012-09-14 to 2012-09-17 |     3 |        |     3  |
|  2011-11-25 to 2011-11-28 |     3 |        |     3  |
|  2014-02-14 to 2014-02-17 |     2 |        |     2  |
|---------------------------+-------+--------+--------|

In [ ]: