Data is beautiful

My first animated graph.

Source of data
https://data.london.gov.uk/dataset/recorded_crime_summary

Tools used
Jupyter notebook with geopandas package

Imagemagick to make the animated giff from png files.

Inspiration
https://towardsdatascience.com/how-to-make-a-gif-map-using-python-geopandas-and-matplotlib-cd8827cefbc8

I spent a geeky weekend learning how to make an animated geographical graph. It was inspired by a post on Medium by Benjamin Cooley (link above). As a newbie it took a long time to learn how to setup the necessary libraries and environment. The data itself is not that interesting. Despite the recent media commotion over knife attacks in London the total crime rate does not show any obvious pattern apart from a two year regression from a longer term downtrend.

myimage3

Average notes and coins in wallet v2

I updated the average coins and notes in wallet model after fine tuning the denominations in circulation using data from http://www.xe.com and calculating random transaction prices using a function that would give benford compliant distributions.

BestCurrencies2

 

Currency Average coins or notes in wallet Currency denominations Denominations
NZ 4.82 10 [10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000]
Swedish 5.05 8 [1, 5, 10, 20, 50, 100, 200, 500]
Euro 5.11 11 [5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000]
Canada 5.54 10 [5, 10, 25, 100, 200, 500, 1000, 2000, 5000, 10000]
Australia 5.72 11 [5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000]
Singapore 5.80 9 [5, 10, 20, 50, 100, 200, 500, 1000, 5000]
Mexican 5.98 11 [50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000, 50000, 100000]
Turkish 6.02 9 [5, 10, 25, 50, 100, 500, 1000, 2000, 5000]
Norwegian 6.28 9 [1, 5, 10, 20, 50, 100, 200, 500, 1000]
SouthKorea 6.32 6 [100, 500, 1000, 5000, 10000, 50000]
Pound 6.43 12 [1, 2, 5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000]
Brazilian 6.46 10 [5, 10, 25, 50, 100, 500, 1000, 2000, 5000, 10000]
Yuan 6.65 8 [10, 50, 100, 500, 1000, 2000, 5000, 10000]
Indian 7.42 10 [50, 100, 200, 500, 1000, 2000, 5000, 10000, 50000, 200000]
Swiss 7.99 13 [5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000, 100000]
HK 8.10 12 [10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 50000, 100000]
SouthAfrica 8.11 10 [5, 10, 20, 100, 200, 1000, 2000, 5000, 10000, 20000]
USA 8.52 10 [1, 5, 10, 25, 100, 500, 1000, 2000, 5000, 10000]
Japan 10.60 9 [1, 5, 10, 50, 100, 500, 1000, 5000, 10000]
Russian 14.05 10 [10, 50, 100, 200, 500, 5000, 10000, 50000, 100000, 500000]

 

% Currencies with a denomination of this unit

DenominationsOfTop20CurrenciesHorizontalFormat

Denomination % worlds top 20 currencies
1 100%
5 95%
10 90%
50 90%
0.1 85%
0.5 80%
100 75%
2 70%
20 70%
0.05 65%
0.2 50%
0.01 25%
500 25%
0.25 20%
1000 20%
200 15%
0.02 5%
2000 5%
5000 5%

 

Source: www.xe.com for commonly used denominations
https://en.wikipedia.org/wiki/Template:Most_traded_currencies

Tool: Excel

Qualifications:
1. Includes the worlds top 20 currencies by trading volumes sourced from wikipedia
2. Shows denominations in frequent use according to www.xe.com
3. Currencies which are not decimalized, like Japanese Yen, are / 100 for comparison purposes

Optimal currency denominations

Tired of walking around with a wallet bulging with notes and coins?

Living in Japan I found it was often more difficult to come up with the right change when making purchases.   Was it my imagination?  No.  The Yen is the worst of the worlds major currencies.

I built a python model to check the relative transaction efficiency of the worlds top 20 currencies and also for a set of artificial currencies with randomish denominations.

The model starts with an empty wallet.  The owner wants to make a purchase.  The purchase is  random number between 1 and the median currency denomination.  If the wallet has insufficient funds the owner will visit an ATM and withdraw one note of the highest currency denomination and put it in the wallet.  The user will handover change to the shopkeeper for each transaction in a way to minimize coins/notes in wallet.

After 100 transactions per currency I will measure the average coins and notes in the wallet.  Then rank the currencies, the fewer coins and notes the user needs to hold during the course of the 100 transactions, the better.

Time to move to Sweden which has the best currency in the world.

 

The denominations below are de-decimalized for ease of processing.

Currency Denominations Average coins or notes in wallet
 Swedish  [1, 2, 5, 10, 20, 50, 100, 200, 500] 4.77
 Norwegian  [1, 5, 10, 20, 50, 100, 200, 500] 5.19
 NZ  [10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000] 5.38
 Australia  [5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000] 5.59
 Brazilian  [5, 10, 25, 50, 100, 200, 500, 1000, 2000, 5000, 10000] 5.77
 Canada  [5, 10, 25, 100, 200, 500, 1000, 2000, 5000, 10000] 5.87
 South Africa  [10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000] 5.92
 Pound  [1, 2, 5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000] 6.19
 Indian  [1, 2, 5, 10, 20, 50, 100, 200, 500, 2000] 6.32
 Mexican  [10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 20000, 50000] 6.45
 Yuan  [10, 50, 100, 500, 1000, 2000, 5000, 10000] 6.52
 Turkish  [5, 10, 25, 50, 100, 500, 1000, 2000, 5000, 10000, 20000] 7.01
 HK  [10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 50000, 100000] 7.76
 Euro  [1, 2, 5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000] 7.76
 Swiss  [5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000, 100000] 8.23
 USA  [1, 5, 10, 25, 100, 500, 1000, 2000, 5000, 10000] 8.51
 Russian  [1, 2, 5, 10, 50, 100, 500, 1000, 5000] 8.70
 South Korea  [10, 50, 100, 500, 1000, 5000, 10000, 50000] 9.43
 Singapore  [5, 10, 20, 50, 100, 200, 500, 1000, 5000, 10000, 100000] 10.64
 Japan  [1, 5, 10, 50, 100, 1000, 5000, 10000] 11.92

 

These are random currencies.  Nothing can beat Sweden.

Random Currency# Denominations Average coins or notes in wallet
16  [4, 8, 16, 32, 64, 128, 256, 768, 2304] 5.07
8  [5, 10, 20, 100, 200, 600, 1200, 2400, 4800, 9600] 6.35
82  [10, 30, 60, 180, 540, 1080, 2160, 10800] 6.41
97  [9, 18, 54, 216, 648, 1296, 3888, 11664] 6.48
17  [8, 24, 72, 144, 576, 1152, 3456, 6912, 13824] 6.53
45  [10, 20, 60, 180, 360, 1440, 5760, 11520] 6.57
88  [7, 14, 28, 84, 168, 672, 3360, 6720, 13440] 6.77
2  [3, 6, 18, 72, 216, 432, 1296, 2592, 10368] 6.83
4  [3, 6, 12, 24, 72, 144, 432, 864, 1728, 8640] 6.99
27  [8, 16, 64, 128, 384, 768, 2304, 11520] 7.01
43  [6, 18, 54, 108, 216, 864, 2592, 10368] 7.08
10  [9, 27, 54, 108, 540, 1080, 3240, 6480, 12960, 25920, 51840] 7.19
24  [7, 35, 105, 315, 945, 1890, 3780, 7560, 15120, 30240] 7.32
31  [6, 12, 24, 72, 216, 864, 1728, 3456, 10368, 31104] 7.36
84  [9, 18, 36, 108, 216, 648, 2592, 5184, 25920] 7.36
40  [4, 12, 36, 144, 288, 864, 1728, 5184, 10368, 20736] 7.4
57  [1, 3, 18, 36, 72, 216, 432, 1728] 7.61
78  [4, 12, 36, 72, 144, 432, 1296, 3888, 7776, 23328] 7.63
92  [8, 24, 96, 288, 864, 2592, 5184, 20736] 7.66
100  [7, 21, 42, 126, 378, 756, 3024, 6048, 18144, 36288] 7.71
49  [7, 14, 28, 84, 168, 336, 1344, 2688, 5376, 10752, 53760] 7.79
81  [3, 6, 12, 60, 180, 360, 720, 2880, 11520] 7.82
41  [9, 27, 81, 324, 972, 3888, 15552, 31104] 7.89
90  [9, 45, 225, 675, 2700, 5400, 10800, 21600] 7.9
25  [2, 4, 8, 16, 80, 160, 480, 960, 2880, 11520] 8.05
91  [8, 24, 48, 192, 384, 768, 1536, 3072, 6144, 12288, 61440, 122880] 8.05
7  [5, 15, 45, 90, 180, 360, 720, 1440, 4320, 25920] 8.22
87  [9, 36, 72, 216, 1296, 2592, 5184, 10368, 20736, 62208] 8.24
58  [4, 8, 32, 64, 192, 384, 1920, 7680, 15360, 30720] 8.41
77  [9, 18, 36, 180, 360, 720, 1440, 4320, 12960, 38880, 116640] 8.41
33  [1, 4, 12, 24, 48, 240, 480, 960, 1920, 3840, 11520] 8.48
93  [3, 9, 27, 54, 324, 648, 1944, 5832, 11664, 23328] 8.48
98  [8, 16, 32, 128, 256, 768, 3072, 6144, 18432, 36864, 110592] 8.51
51  [2, 4, 16, 32, 128, 384, 768, 2304, 6912, 20736] 8.55
23  [7, 21, 42, 84, 252, 1008, 3024, 12096, 36288, 72576] 8.59
44  [10, 20, 40, 80, 240, 1440, 7200, 28800, 57600] 8.6
60  [10, 30, 180, 360, 720, 1440, 2880, 5760, 11520, 57600] 8.64
37  [6, 30, 60, 240, 720, 2160, 4320, 12960, 25920, 77760] 8.66
13  [7, 21, 42, 84, 168, 336, 1008, 6048, 12096, 24192, 96768] 8.67
32  [10, 20, 40, 80, 160, 320, 640, 1280, 2560, 10240, 51200, 153600] 8.67
63  [6, 12, 36, 72, 144, 576, 1728, 3456, 20736, 41472] 8.68
70  [1, 2, 6, 12, 24, 96, 288, 1152, 2304, 9216, 18432] 8.68
76  [5, 10, 20, 60, 120, 360, 1800, 9000, 36000] 8.69
42  [10, 20, 60, 180, 540, 1620, 4860, 19440, 77760] 8.7
95  [7, 14, 28, 84, 252, 756, 1512, 4536, 13608, 40824, 122472] 8.71
26  [7, 14, 42, 84, 420, 840, 1680, 3360, 10080, 50400] 8.75
9  [3, 9, 27, 108, 324, 972, 1944, 3888, 11664, 34992] 8.77
11  [9, 18, 90, 180, 540, 2160, 4320, 12960, 38880, 77760] 8.79
72  [9, 18, 36, 144, 288, 864, 1728, 5184, 10368, 51840, 155520] 8.8
35  [7, 35, 70, 210, 840, 1680, 3360, 10080, 20160, 60480, 120960] 8.83
59  [2, 4, 12, 48, 96, 192, 576, 1152, 2304, 9216, 18432, 36864] 8.84
50  [7, 28, 112, 224, 896, 1792, 5376, 10752, 32256, 96768] 8.89
94  [9, 18, 36, 108, 216, 648, 1296, 2592, 5184, 15552, 108864] 8.91
1  [9, 27, 108, 216, 648, 1296, 5184, 10368, 31104, 62208, 124416] 8.94
36  [1, 4, 8, 16, 48, 96, 384, 768, 2304, 11520] 8.95
28  [6, 24, 48, 96, 192, 384, 1152, 4608, 9216, 27648, 110592] 8.96
14  [3, 18, 54, 108, 216, 864, 3456, 17280] 9
61  [4, 16, 32, 128, 384, 1536, 6144, 12288, 36864] 9.05
52  [10, 40, 120, 240, 480, 2400, 7200, 14400, 72000, 144000] 9.06
48  [6, 12, 60, 180, 900, 2700, 10800, 21600, 43200] 9.08
85  [2, 10, 20, 80, 240, 720, 2880, 11520] 9.15
66  [9, 18, 36, 72, 144, 576, 1152, 4608, 18432, 55296, 165888] 9.18
96  [9, 27, 81, 162, 324, 1296, 7776, 31104, 62208] 9.23
18  [5, 15, 60, 240, 720, 1440, 2880, 5760, 23040, 92160] 9.26
34  [9, 18, 36, 144, 432, 2592, 7776, 23328, 69984] 9.32
67  [7, 14, 42, 168, 504, 1512, 7560, 22680, 68040, 136080] 9.45
47  [10, 50, 200, 400, 800, 5600, 22400, 44800] 9.49
22  [2, 6, 12, 48, 192, 576, 1728, 6912, 27648] 9.5
62  [7, 21, 42, 126, 252, 1008, 4032, 24192, 72576] 9.53
80  [8, 24, 96, 288, 864, 5184, 15552, 31104, 93312] 9.54
15  [7, 28, 84, 336, 1008, 3024, 9072, 54432, 108864] 9.64
75  [8, 16, 32, 192, 768, 3072, 12288, 49152] 9.64
69  [6, 18, 36, 72, 216, 432, 2160, 8640, 17280, 86400] 9.66
20  [7, 14, 28, 56, 112, 448, 2688, 16128, 48384, 96768] 9.69
99  [3, 9, 27, 135, 270, 540, 2700, 10800, 21600, 43200] 9.7
79  [10, 30, 60, 120, 600, 1200, 4800, 19200, 38400, 153600] 9.72
30  [5, 10, 20, 40, 160, 800, 2400, 9600, 28800, 86400] 9.73
39  [10, 40, 80, 400, 2000, 8000, 32000, 64000] 9.83
3  [6, 12, 72, 144, 432, 864, 1728, 5184, 25920, 103680] 9.96
55  [4, 20, 80, 240, 960, 3840, 19200, 38400] 10.01
6  [10, 30, 120, 240, 480, 2880, 11520, 23040, 115200] 10.06
5  [9, 18, 72, 216, 432, 1728, 13824, 55296, 110592] 10.07
12  [7, 14, 42, 126, 1008, 3024, 12096, 24192, 72576] 10.07
71  [5, 10, 20, 60, 300, 1200, 7200, 28800, 57600] 10.1
21  [1, 5, 10, 30, 90, 540, 1620, 4860, 14580] 10.13
54  [7, 14, 42, 168, 504, 1008, 7056, 21168, 84672] 10.26
83  [6, 36, 144, 576, 1152, 5760, 23040, 69120] 10.32
19  [1, 3, 12, 36, 252, 756, 1512, 3024, 12096] 10.43
73  [2, 4, 24, 48, 288, 864, 5184, 10368, 20736] 10.43
29  [9, 18, 108, 648, 1296, 3888, 11664, 58320, 174960] 10.86
86  [7, 28, 168, 1176, 4704, 14112, 42336, 84672] 10.9
46  [8, 48, 240, 480, 2400, 4800, 24000, 96000] 11.09
65  [8, 16, 112, 672, 3360, 13440, 26880, 80640] 11.18
53  [4, 8, 64, 192, 576, 1728, 10368, 31104, 62208] 11.22
74  [1, 6, 30, 120, 600, 1800, 9000] 11.24
38  [4, 12, 24, 72, 432, 864, 2592, 18144, 72576] 11.3
56  [10, 30, 120, 240, 480, 2880, 8640, 69120, 138240] 11.36
89  [6, 36, 108, 432, 1296, 6480, 25920, 103680] 11.47
64  [8, 16, 128, 512, 4096, 16384, 32768, 98304] 11.58
68  [4, 16, 96, 288, 864, 4320, 8640, 60480] 12.16