{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Tutorial \n", "\n", "## Understanding your customers with Customer Intelligence" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Every company wants to know which of their customers love them, and where to find new customers who will feel the same. \n", "\n", "Imagine your company is looking to open more UK outlets. If you knew exactly *who* would love your products, you would open your stores close by. What makes someone likely to be a customer is a difficult question, but can be answered with the clever use of data.\n", "\n", "We built **Customer Intelligence** in Faculty to provide insights specific to each business from knowning only the postcodes of current customers or retail points. *Customer Intelligence* discovers areas where people are demographically similar to your existing customer base. You can use *Customer Intelligence* to answer questions like \"What describes our best customers?\" and \"Where can we find more customers who will love our product?\"\n", "\n", "Say you are a food retailer deciding where to open new stores. We can use the postcodes of Lidl and Waitrose to show how *Customer Intelligence* recommends different locations for new stores based on the different customer demographics of each business." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": true }, "outputs": [], "source": [ "from faculty_extras import opendata\n", "import faculty_extras.customerintelligence as ci\n", "\n", "import matplotlib as mpl\n", "from matplotlib import pyplot\n", "\n", "from IPython.display import display, HTML\n", "\n", "%matplotlib inline" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def display_colorbar(colormap_name, title, ticks=[0, 1], \n", " labels=['Low', 'High'], fontsize=16):\n", " \"\"\" Display a matplotlib colormap. \"\"\"\n", " \n", " fig, axes = pyplot.subplots(figsize=(10, 0.5))\n", "\n", " # Normalise colours to match the range of values\n", " norm = mpl.colors.Normalize(vmin=min(ticks), vmax=max(ticks))\n", " \n", " # Plot colourbar\n", " cbr = mpl.colorbar.ColorbarBase(\n", " axes,\n", " cmap=mpl.cm.get_cmap(colormap_name),\n", " norm=norm,\n", " orientation='horizontal',\n", " ticks=ticks\n", " )\n", " axes.set_title(title, fontsize=fontsize)\n", " axes.set_xticklabels(labels, fontsize=fontsize)\n", " \n", " pyplot.show()\n", " \n", "# Select colormap for visualisation\n", "COLORMAP = 'viridis'" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "# Load data\n", "lidl = opendata.load('tutorials/supermarkets/lidl.csv')\n", "waitrose = opendata.load('tutorials/supermarkets/waitrose.csv')" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "# Analyse with Customer Intelligence \n", "insight_lidl = ci.analyse(lidl['postcode']) \n", "insight_waitrose = ci.analyse(waitrose['postcode'])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "For example, the map below identifies areas of the UK where the the population is demographically similar to the customer basis of Lidl. " ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "

Lidl

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAl4AAABRCAYAAAAD6Kh6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAACtNJREFUeJzt3W+sbNVZx/Hv71wsSGmbNk2BmFa0EvxDYqtUhKQUaI3E\nSgqmVdpIxGooKbavEEkk0hTxBdGgEkvAqjWFqkDFSiGlELiA2pYKFsXCBewfogVKoYVSCsTexxd7\nz7kze/bMnLlnzr6S+/0kJzN77fU8a+2595zzZK81c1JVSJIkaeut7ekJSJIk7S0svCRJkgZi4SVJ\nkjQQCy9JkqSBWHhJkiQNxMJLkiRpIBZekhZKclKS25J8Pcl3k3w1yT8kOWGsz2lJKskhKxrz2Dbf\nsWNt25NsX0X+sZwfSfKVseNDknwgyQ+vchxJAgsvSQskeT9wDfAA8BvAW4Hfb08fP9b1OuAo4OEV\nDX1Xm++uFeWb5Xzg5LHjQ4DzAAsvSSsXP0BV0jxJHgLurKqTe86tVdXOAeeyHaCqjl1Brn2r6rme\n9mOBW4Cfq6qbNjuOJI3zjpekRV4BPNJ3Yrzo6ltqTPKVJJcnOTXJjnaZ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cf\nt8pBXGqUJEkayMr+SLYkSZLms/CSJEkaiIWXJEnSQCy8JEmSBmLhJUmSNBALL0mSpIH8H8dO2BH0\nzP19AAAAAElFTkSuQmCC\n", "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "display(HTML('

Lidl

'))\n", "display(insight_lidl.similarity_map(colourmap=COLORMAP, bins=50))\n", "display_colorbar(COLORMAP, title='Similarity')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "On a national scale, it appears that Lidl stores are likely to be successful in smaller towns and rural areas. Regions that stand out as distinctly favourable are Northern Ireland, the north of Wales, and the East Midlands. \n", "\n", "Focusing on London, one finds that Lidl may gain new customers in less affluent boroughs at the edge of the metropolis. In particular, the residents of Newham or Brent appear to be demographically similar to the customer base of Lidl. \n", "\n", "Let's draw the map based on the postcodes of Waitrose stores." ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/html": [ "

Waitrose

" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAl4AAABRCAYAAAAD6Kh6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAACtNJREFUeJzt3W+sbNVZx/Hv71wsSGmbNk2BmFa0EvxDYqtUhKQUaI3E\nSgqmVdpIxGooKbavEEkk0hTxBdGgEkvAqjWFqkDFSiGlELiA2pYKFsXCBewfogVKoYVSCsTexxd7\nz7kze/bMnLlnzr6S+/0kJzN77fU8a+2595zzZK81c1JVSJIkaeut7ekJSJIk7S0svCRJkgZi4SVJ\nkjQQCy9JkqSBWHhJkiQNxMJLkiRpIBZekhZKclKS25J8Pcl3k3w1yT8kOWGsz2lJKskhKxrz2Dbf\nsWNt25NsX0X+sZwfSfKVseNDknwgyQ+vchxJAgsvSQskeT9wDfAA8BvAW4Hfb08fP9b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64Oyq+k6n/y00G91u7rQV8FBVfXnJOUmSJG3W6cC3gbOBF9HUKWcCn6S5ybQS8eOyJEmSpiU5\nC7gQOKSqHlpFTv9kkCRJ2usl+UXgcOALNEuLbwTOAq5cVdEFFl6SJEnQLDOeRPPXd14M/A/NB8Cf\nt8pBXGqUJEkayMr+SLYkSZLms/CSJEkaiIWXJEnSQCy8JEmSBmLhJUmSNBALL0mSpIH8H8dO2BH0\nzP19AAAAAElFTkSuQmCC\n", "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "display(HTML('

Waitrose

'))\n", "display(insight_waitrose.similarity_map(colourmap=COLORMAP,\n", " bins=50))\n", "display_colorbar(COLORMAP, title='Similarity')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "It is immediately evident that potential customers of high end supermarkets mostly live in cities. Focusing on London, Waitrose customers are most likely to be found in the wealthy boroughs at the centre or south-west of the capital. Finally, comparing the above maps verifies that zones favourable to high-end chains are mostly not promising for Lidl stores. \n", "\n", "We can go beyond large scale analysis, and recommend specific locations where new stores ought to be opened. Customer Intelligence can rank locations according to their statistical similarity to a customer base. For instance, the top 5 postcode sectors that most resemble the customer basis of Lidl, and where one may then consider opening a Lidl supermarket are:" ] }, { "cell_type": "code", "execution_count": 7, "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", "
postcodesectorsimilarity_score
1LA4 94.676084
2DY13 34.676084
3DL1 94.676084
4DY8 94.676084
5FY4 94.676084
\n", "
" ], "text/plain": [ " postcodesector similarity_score\n", "1 LA4 9 4.676084\n", "2 DY13 3 4.676084\n", "3 DL1 9 4.676084\n", "4 DY8 9 4.676084\n", "5 FY4 9 4.676084" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df = insight_lidl.similarity_score(aggregation='postcodesector',\n", " sort=True).head(5)\n", "df.index = range(1, 6)\n", "df" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In contrast, here are the top 5 locations most similar to the customer base of Waitrose, and where they may want to consider opening stores:" ] }, { "cell_type": "code", "execution_count": 8, "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", "
postcodesectorsimilarity_score
1KT22 28.197331
2EC3M 68.197331
3EC3M 38.197331
4WF90 88.197331
5EC2N 28.197331
\n", "
" ], "text/plain": [ " postcodesector similarity_score\n", "1 KT22 2 8.197331\n", "2 EC3M 6 8.197331\n", "3 EC3M 3 8.197331\n", "4 WF90 8 8.197331\n", "5 EC2N 2 8.197331" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df = insight_waitrose.similarity_score(aggregation='postcodesector',\n", " sort=True).head(5)\n", "df.index = range(1, 6)\n", "df" ] }, { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "Even with simple data, *Customer Intelligence* gives us the tools to extract useful insights, and to visualise the results." ] } ], "metadata": { "anaconda-cloud": {}, "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.5" } }, "nbformat": 4, "nbformat_minor": 2 }