Faculty Customer Intelligence

Getting Started

Pass a sequence of customer postcodes to analyse():

>>> from faculty_extras import customerintelligence
>>> postcodes = ['AB10 1AA', 'AB10 1AB', 'AB10 1AF', ...]
>>> result = customerintelligence.analyse(postcodes)

Exploring the Results

The analysis result returned from analyse() includes methods to explore how similar people in different areas across the UK are to your customers. To visualise overall similarity by parliamentary constituency, run:

>>> result.similarity_map()

It is also possible to visualise similarity by other aggregations, such as by local authority or census output area. To discover all the possible options to similarity_map(), check its documentation.

similarity_map() returns a folium Map object. This can be rendered as an HTML file with its save() method:

>>> map = result.similarity_map()
>>> map.save('map.html')

To get the values of similarity to your customers at various levels of aggregation, including by postcode, postcode sector and outcode:

>>> result.similarity_score('postcode')

similarity_score() also can take an optional sort argument, allowing you to presort by similarity score and then retrieve, for example, the 500 most similar postcode sectors to your customers:

>>> result.similarity_score('postcodesector', sort=True).head(500)

Read/Write of Results

You can write reports to disk with to_json():

>>> with open('report.json', 'w') as fp:
>>>     result.dump(fp)

and read with:

>>> with open('report.json') as fp:
>>>     result = customerintelligence.AnalysisResult.load(fp)