First Competition of EduardoLoz - Denver Coffee Shop
  • AI Chat
  • Code
  • Report
  • Beta
    Spinner

    Where to open a new coffee shop?

    📖 Background

    You are helping a client who owns coffee shops in Colorado. The company's coffee shops serve high-quality and responsibly sourced coffee, pastries, and sandwiches. They operate three locations in Fort Collins and want to expand into Denver.

    Your client believes that the ideal location for a new store is close to affluent households, and the store appeals to the 20-35 year old demographic.

    Your team collected geographical and demographic information about Denver's neighborhoods to assist the search. They also collected data for Starbucks stores in Denver. Starbucks and the new coffee shops do not compete for the same clients; the team included their location as a reference.

    💾 The data

    You have assembled information from three different sources (locations, neighborhoods, demographics):

    Starbucks locations in Denver, Colorado
    • "StoreNumber" - Store Number as assigned by Starbucks
    • "Name" - Name identifier for the store
    • "PhoneNumber" - Phone number for the store
    • "Street 1, 2, and 3" - Address for the store
    • "PostalCode" - Zip code of the store
    • "Longitude, Latitude" - Coordinates of the store
    Neighborhoods' geographical information
    • "NBHD_ID" - Neighborhood ID (matches the census information)
    • "NBHD_NAME" - Name of the statistical neighborhood
    • "Geometry" - Polygon that defines the neighborhood
    Demographic information
    • "NBHD_ID" - Neighborhood ID (matches the geographical information)
    • "NBHD_NAME' - Nieghborhood name
    • "POPULATION_2010' - Population in 2010
    • "AGE_ " - Number of people in each age bracket (< 18, 18-34, 35-65, and > 65)
    • "NUM_HOUSEHOLDS" - Number of households in the neighborhood
    • "FAMILIES" - Number of families in the neighborhood
    • "NUM_HHLD_100K+" - Number of households with income above 100 thousand USD per year

    Starbucks locations were scrapped from the Starbucks store locator webpage by Chris Meller.
    Statistical Neighborhood information from the City of Denver Open Data Catalog, CC BY 3.0 license.
    Census information from the United States Census Bureau. Publicly available information.

    %%capture
    pip install geopandas
    import pandas as pd
    import geopandas as gpd
    denver = pd.read_csv('./data/denver.csv')
    denver
    neighborhoods = gpd.read_file('./data/neighborhoods.shp')
    neighborhoods
    census = pd.read_csv('./data/census.csv')
    census

    💪 Challenge

    Provide your client a list of neighborhoods in Denver where they should consider expanding. Include:

    • A visualization of Denver's neighborhoods and the Starbucks store locations.
    • Find the neighborhoods with the highest proportion of people in the target demographic.
    • Select the top three neighborhoods where your client should focus their search.

    💪 Coding

    import matplotlib.pyplot as plt
    from geopandas import GeoSeries
    from shapely.geometry import Polygon
    from mpl_toolkits.axes_grid1 import make_axes_locatable
    
    plt.rcParams["figure.figsize"]=10,10
    fig, ax = plt.subplots(1, 1)
    
    Starbucks=plt.scatter(denver["Longitude"],denver["Latitude"], alpha=0.4, color="white", edgecolor="red", linewidths= 0.7, s= 50, zorder=2, label="Starbucks")
    divider = make_axes_locatable(ax)
    cax = divider.append_axes("right", size="5%", pad=0.1)
    
    
    census["Age Range %"]=census["AGE_18_TO_34"]/census["POPULATION_2010"]
    census["Rich"]=census["NUM_HHLD_100K+"]/census["NUM_HOUSEHOLDS"]
    census1=census.drop(columns=["NBHD_NAME", 'POPULATION_2010', 'AGE_LESS_18',"AGE_18_TO_34","AGE_35_TO_65","AGE_65_PLUS","FAMILIES", "NUM_HHLD_100K+" ])
    
    jovenes=census1[census1["Age Range %"]>=0.5]
    jovenes1=jovenes[jovenes["NUM_HOUSEHOLDS"]>=3000]
    jovenes1=jovenes1.sort_values(by=["Age Range %"], ascending=False)
    Jovenes1=jovenes1.merge(neighborhoods, on="NBHD_ID")
    Jovenes1=Jovenes1[["NBHD_NAME","NUM_HOUSEHOLDS","Age Range %","Rich"]]
    print(Jovenes1)
    
    #I chose University, Capitol Hill and North Capitol Hill neighborhoods because it has a good number of households (above average) and with a high percentaje of people around 18 and 34 years old. What is more, this 3 region have a good percentaje of houses with more the 100k per year. Starbucks also have many stores gathered in my top picks.
    
    jovenes2=neighborhoods.merge(jovenes1, on="NBHD_ID")
    neighborhoods1=neighborhoods.merge(census1, on="NBHD_ID")
    nb=neighborhoods1.plot(column="Age Range %", ax=ax, legend=True, zorder=1, cax=cax)
    J=jovenes2["geometry"].plot(ax=nb, color= "lightgrey",edgecolor="red", hatch= "///", zorder=1, alpha=0.5)
    
    plt.legend(handles=[Starbucks,J])
    plt.xlabel("Youth")
    plt.ylabel("Percentaje of targeted clients")