<jupyter_start><jupyter_text>http://geolytix.co.uk/blog/category/open-data/supermarket-locations/<jupyter_code>import os

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

import seaborn
%matplotlib inline
font = {'family' : 'monospace',
        'weight' : 'bold',
        'size'   : 14}

plt.rc('font', **font)
plt.rc('figure', figsize=(18, 6))
os.chdir('../datasets/open-supermarkets/')
supermarkets = pd.read_csv('GeoLytixOpenSupermarketLocationsSept2015v6.txt', sep='\t')
supermarkets.head()<jupyter_output><empty_output><jupyter_text>Visualise<jupyter_code>vc = supermarkets['Retailer'].value_counts()[:10]  # keep the top-10

idx = np.arange(len(vc.index))
plt.bar(
    idx, vc.values, tick_label=vc.index, align='center'
)
from ipywidgets import HTML

HTML('<iframe width="100%" height="520" frameborder="0" '
     'src="https://additionplus.cartodb.com/viz/cf091c2c-d4f0-11e5-a5e6-0ef24382571b/embed_map" '
     'allowfullscreen webkitallowfullscreen mozallowfullscreen oallowfullscreen msallowfullscreen legend'
     '></iframe>')<jupyter_output><empty_output><jupyter_text>Enrich with the regional labour market data[Regional labour market: LI02 - Local indicators for parliamentary constituencies, January 2016 (Excel sheet 314Kb)](http://www.ons.gov.uk/ons/rel/subnational-labour/regional-labour-market-statistics/january-2016/rft-lm-table-li02-january-2016.xls)<jupyter_code>labour_market = pd.read_csv('regional_labour_market_li02_2016-01.csv').dropna()
labour_market.head()<jupyter_output><empty_output><jupyter_text>Join on town<jupyter_code>joined = supermarkets.merge(labour_market, left_on='Town', right_on='region', how='outer')
labour_market[labour_market['region'] == 'Hatfield']<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14489446662863661, 'fraction_numerical': 0.0387906446092413, 'mean_word_length': 6.900900900900901, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '576918', 'license': 'Apache-2.0', 'n_tokens_mistral': 704, 'n_tokens_neox': 638, 'n_words': 91, 'path': 'notebooks/01 Open supermarkets and external datasets.ipynb', 'repo_name': 'shuaiyuancn/commercial-science-taster', 'size': '1753'}