DataFrame Access

Introduction

A DataFrame is composed of a collection of column vectors represented by Morpheus Arrays, and the frame API provides various mechanisms for reading and writing data in a type safe and efficient manner (for example, avoiding boxing of primitive types). Elements can be read or written using a random access API, or they can be consumed iteratively, including via Java 8 streams. It is also possible to process rows and columns in an efficient manner that places very little burden on the Garbage Collector. The following sections illustrates various DataFrame access scenarios.

One of the design goals of Morpheus was to formulate a flexible API that is both intuitive and consistent, so that operations that apply at the frame level look and feel similar to operations that work on either the row or column dimension of the DataFrame. There is also a strong emphasis on type safety, so most of the peripheral interfaces in Morpheus are paramterised by both the row and column key types.

ONS Population Dataset

The examples in this section mostly operate on a population dataset made available by the Office for National Statistics (ONS) in the UK, which is described here and accessible here. (unless the example creates a custom DataFrame for illustration). The ONS dataset provides a population decomposition by gender and age across various boroughs and wards in the UK, between 1999 and 2014. The data can be loaded as follows, and the first 10 rows are shown below. The row axis in this example is a composite k ey made up of two items from each row, namely the year and the borough name.

/**
 * Returns the ONS population dataset for UK boroughs
 * @return  the ONS population dataser
 */
static DataFrame<Tuple,String> loadPopulationDataset() {
    return DataFrame.read().csv(options -> {
        options.setResource("http://tinyurl.com/ons-population-year");
        options.setRowKeyParser(Tuple.class, row -> Tuple.of(Integer.parseInt(row[1]), row[2]));
        options.setExcludeColumns("Code");
        options.getFormats().setNullValues("-");
        options.setColumnType("All Males", Double.class);
        options.setColumnType("All Females", Double.class);
        options.setColumnType("All Persons", Double.class);
        options.setColumnType("[MF]\\s+\\d+", Double.class);
    });
}

In the parsing code above, we expressly coerce the various counts into a double type as the default CSV parsing logic would assume these are integers. The reason we parse them into doubles is to allow us to perform computations on these values, such as converting them to percentages, and therefore a double precision representation makes sense.

         Index          |  Year  |     Borough      |  All Persons  |  All Males  |    M 0    |    M 1    |    M 2    |    M 3    |    M 4    |    M 5    |    M 6    |    M 7    |    M 8    |    M 9    |   M 10    |   M 11    |   M 12    |   M 13    |   M 14    |   M 15    |   M 16    |   M 17    |   M 18    |   M 19    |   M 20    |   M 21    |   M 22    |   M 23    |   M 24    |    M 25    |    M 26    |    M 27    |    M 28    |    M 29    |    M 30    |    M 31    |    M 32    |    M 33    |    M 34    |    M 35    |    M 36    |    M 37    |    M 38    |    M 39    |    M 40    |   M 41    |   M 42    |   M 43    |   M 44    |   M 45    |   M 46    |   M 47    |   M 48    |   M 49    |    M 50    |    M 51    |    M 52    |   M 53    |   M 54    |   M 55    |   M 56    |   M 57    |   M 58    |   M 59    |   M 60    |   M 61    |   M 62    |   M 63    |   M 64    |   M 65    |   M 66    |   M 67    |   M 68    |   M 69    |   M 70    |   M 71    |   M 72    |   M 73    |   M 74    |   M 75    |   M 76    |   M 77    |   M 78    |   M 79    |   M 80    |   M 81    |   M 82    |   M 83    |   M 84    |   M 85    |   M 86    |   M 87    |   M 88    |   M 89   |  M 90+  |  All Females  |    F 0    |    F 1    |    F 2    |    F 3    |    F 4    |    F 5    |    F 6    |    F 7    |    F 8    |    F 9    |   F 10    |   F 11    |   F 12    |   F 13    |   F 14    |   F 15    |   F 16    |   F 17    |   F 18    |   F 19    |   F 20    |   F 21    |   F 22    |   F 23    |   F 24    |   F 25    |    F 26    |   F 27    |    F 28    |    F 29    |    F 30    |   F 31    |    F 32    |    F 33    |   F 34    |   F 35    |   F 36    |   F 37    |   F 38    |   F 39    |   F 40    |   F 41    |   F 42    |   F 43    |   F 44    |   F 45    |   F 46    |   F 47    |   F 48    |   F 49    |   F 50    |   F 51    |   F 52    |   F 53    |   F 54    |   F 55    |   F 56    |   F 57    |   F 58    |   F 59    |   F 60    |   F 61    |   F 62    |   F 63    |   F 64    |   F 65    |   F 66    |   F 67    |   F 68    |   F 69    |   F 70    |   F 71    |   F 72    |   F 73    |   F 74    |   F 75    |   F 76    |   F 77    |   F 78    |   F 79    |   F 80    |   F 81    |   F 82    |   F 83    |   F 84    |   F 85    |   F 86    |   F 87    |   F 88    |   F 89    |  F 90+  |
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 (1999,City of London)  |  1999  |  City of London  |    6581.0000  |  3519.0000  |  24.0000  |  23.0000  |  22.0000  |  21.0000  |  20.0000  |  21.0000  |  20.0000  |  21.0000  |  20.0000  |  22.0000  |  22.0000  |  21.0000  |  19.0000  |  18.0000  |  17.0000  |  17.0000  |  17.0000  |  21.0000  |  26.0000  |  32.0000  |  40.0000  |  47.0000  |  52.0000  |  60.0000  |  65.0000  |   70.0000  |   73.0000  |   73.0000  |   73.0000  |   78.0000  |   78.0000  |   77.0000  |   75.0000  |   72.0000  |   71.0000  |   71.0000  |   65.0000  |   60.0000  |   58.0000  |   58.0000  |   57.0000  |  55.0000  |  51.0000  |  53.0000  |  53.0000  |  59.0000  |  59.0000  |  60.0000  |  65.0000  |  68.0000  |   68.0000  |   70.0000  |   63.0000  |  62.0000  |  61.0000  |  54.0000  |  49.0000  |  47.0000  |  43.0000  |  38.0000  |  35.0000  |  34.0000  |  34.0000  |  33.0000  |  32.0000  |  31.0000  |  32.0000  |  31.0000  |  30.0000  |  30.0000  |  29.0000  |  27.0000  |  26.0000  |  24.0000  |  23.0000  |  20.0000  |  20.0000  |  18.0000  |  17.0000  |  15.0000  |  14.0000  |  12.0000  |  12.0000  |  11.0000  |  11.0000  |  43.0000  |      NaN  |      NaN  |      NaN  |     NaN  |      0  |    3062.0000  |  24.0000  |  24.0000  |  22.0000  |  22.0000  |  21.0000  |  21.0000  |  19.0000  |  19.0000  |  18.0000  |  18.0000  |  18.0000  |  16.0000  |  17.0000  |  16.0000  |  16.0000  |  16.0000  |  20.0000  |  25.0000  |  26.0000  |  30.0000  |  39.0000  |  47.0000  |  50.0000  |  54.0000  |  61.0000  |  68.0000  |   71.0000  |  72.0000  |   71.0000  |   73.0000  |   71.0000  |  68.0000  |   66.0000  |   62.0000  |  55.0000  |  51.0000  |  47.0000  |  43.0000  |  42.0000  |  39.0000  |  39.0000  |  41.0000  |  42.0000  |  43.0000  |  44.0000  |  40.0000  |  44.0000  |  45.0000  |  47.0000  |  48.0000  |  49.0000  |  49.0000  |  50.0000  |  46.0000  |  44.0000  |  39.0000  |  36.0000  |  34.0000  |  33.0000  |  31.0000  |  30.0000  |  29.0000  |  29.0000  |  30.0000  |  31.0000  |  30.0000  |  30.0000  |  29.0000  |  29.0000  |  28.0000  |  26.0000  |  26.0000  |  25.0000  |  23.0000  |  21.0000  |  20.0000  |  20.0000  |  19.0000  |  17.0000  |  17.0000  |  17.0000  |  16.0000  |  15.0000  |  14.0000  |  13.0000  |  76.0000  |      NaN  |      NaN  |      NaN  |      NaN  |      0  |
 (2000,City of London)  |  2000  |  City of London  |    7014.0000  |  3775.0000  |  25.0000  |  25.0000  |  24.0000  |  23.0000  |  22.0000  |  21.0000  |  22.0000  |  21.0000  |  22.0000  |  21.0000  |  22.0000  |  20.0000  |  18.0000  |  16.0000  |  16.0000  |  15.0000  |  17.0000  |  19.0000  |  24.0000  |  30.0000  |  39.0000  |  48.0000  |  57.0000  |  64.0000  |  72.0000  |   81.0000  |   88.0000  |   90.0000  |   90.0000  |   91.0000  |   94.0000  |   94.0000  |   90.0000  |   86.0000  |   81.0000  |   80.0000  |   76.0000  |   70.0000  |   65.0000  |   62.0000  |   62.0000  |  62.0000  |  59.0000  |  56.0000  |  56.0000  |  56.0000  |  62.0000  |  62.0000  |  62.0000  |  67.0000  |   71.0000  |   71.0000  |   74.0000  |  66.0000  |  64.0000  |  63.0000  |  56.0000  |  50.0000  |  47.0000  |  43.0000  |  39.0000  |  34.0000  |  32.0000  |  31.0000  |  30.0000  |  29.0000  |  28.0000  |  28.0000  |  27.0000  |  28.0000  |  27.0000  |  26.0000  |  25.0000  |  23.0000  |  22.0000  |  22.0000  |  19.0000  |  19.0000  |  17.0000  |  16.0000  |  15.0000  |  14.0000  |  12.0000  |  12.0000  |  11.0000  |  39.0000  |      NaN  |      NaN  |      NaN  |     NaN  |      0  |    3239.0000  |  26.0000  |  24.0000  |  24.0000  |  22.0000  |  21.0000  |  21.0000  |  20.0000  |  19.0000  |  19.0000  |  19.0000  |  19.0000  |  18.0000  |  17.0000  |  18.0000  |  17.0000  |  18.0000  |  20.0000  |  23.0000  |  28.0000  |  32.0000  |  38.0000  |  49.0000  |  58.0000  |  61.0000  |  69.0000  |  75.0000  |   82.0000  |  83.0000  |   84.0000  |   81.0000  |   80.0000  |  76.0000  |   73.0000  |   69.0000  |  64.0000  |  57.0000  |  53.0000  |  48.0000  |  44.0000  |  43.0000  |  41.0000  |  42.0000  |  41.0000  |  43.0000  |  43.0000  |  44.0000  |  41.0000  |  45.0000  |  45.0000  |  47.0000  |  49.0000  |  50.0000  |  51.0000  |  51.0000  |  47.0000  |  45.0000  |  41.0000  |  37.0000  |  35.0000  |  32.0000  |  30.0000  |  29.0000  |  28.0000  |  27.0000  |  28.0000  |  29.0000  |  28.0000  |  28.0000  |  28.0000  |  28.0000  |  27.0000  |  25.0000  |  25.0000  |  24.0000  |  22.0000  |  21.0000  |  19.0000  |  20.0000  |  19.0000  |  17.0000  |  16.0000  |  15.0000  |  15.0000  |  15.0000  |  13.0000  |  81.0000  |      NaN  |      NaN  |      NaN  |      NaN  |      0  |
 (2001,City of London)  |  2001  |  City of London  |    7359.0000  |  3984.0000  |  17.0000  |  30.0000  |  25.0000  |  19.0000  |  21.0000  |  25.0000  |  20.0000  |  16.0000  |  19.0000  |  27.0000  |  26.0000  |  16.0000  |  29.0000  |  19.0000  |  11.0000  |  14.0000  |  12.0000  |  13.0000  |  12.0000  |  27.0000  |  38.0000  |  39.0000  |  53.0000  |  63.0000  |  80.0000  |  110.0000  |  110.0000  |  100.0000  |  108.0000  |  125.0000  |  114.0000  |   95.0000  |   93.0000  |  105.0000  |   99.0000  |   84.0000  |   89.0000  |   71.0000  |   63.0000  |   75.0000  |   65.0000  |  52.0000  |  47.0000  |  76.0000  |  73.0000  |  54.0000  |  49.0000  |  45.0000  |  60.0000  |  49.0000  |  111.0000  |   73.0000  |   55.0000  |  81.0000  |  80.0000  |  61.0000  |  63.0000  |  56.0000  |  64.0000  |  48.0000  |  28.0000  |  34.0000  |  45.0000  |  36.0000  |  25.0000  |  28.0000  |  21.0000  |  28.0000  |  21.0000  |  27.0000  |  27.0000  |  21.0000  |  24.0000  |  29.0000  |  21.0000  |  19.0000  |  23.0000  |  20.0000  |  11.0000  |  19.0000  |  15.0000  |  14.0000  |   8.0000  |  15.0000  |  10.0000  |   6.0000  |  10.0000  |   5.0000  |   4.0000  |  3.0000  |     13  |    3375.0000  |  32.0000  |  30.0000  |  23.0000  |  21.0000  |  26.0000  |  16.0000  |  21.0000  |  15.0000  |  18.0000  |  24.0000  |  20.0000  |  20.0000  |  10.0000  |  26.0000  |  13.0000  |  13.0000  |  14.0000  |  39.0000  |  28.0000  |  35.0000  |  47.0000  |  39.0000  |  49.0000  |  54.0000  |  74.0000  |  93.0000  |   89.0000  |  80.0000  |   84.0000  |  107.0000  |   85.0000  |  83.0000  |  101.0000  |   66.0000  |  60.0000  |  54.0000  |  66.0000  |  60.0000  |  48.0000  |  45.0000  |  37.0000  |  28.0000  |  31.0000  |  63.0000  |  43.0000  |  53.0000  |  50.0000  |  47.0000  |  35.0000  |  42.0000  |  37.0000  |  65.0000  |  48.0000  |  57.0000  |  57.0000  |  38.0000  |  45.0000  |  38.0000  |  38.0000  |  33.0000  |  32.0000  |  32.0000  |  26.0000  |  25.0000  |  24.0000  |  29.0000  |  28.0000  |  27.0000  |  34.0000  |  27.0000  |  20.0000  |  26.0000  |  24.0000  |  31.0000  |  18.0000  |  24.0000  |  27.0000  |  13.0000  |  13.0000  |  15.0000  |  18.0000  |  22.0000  |  18.0000  |  11.0000  |  10.0000  |  10.0000  |  14.0000  |  26.0000  |  16.0000  |   7.0000  |     15  |
 (2002,City of London)  |  2002  |  City of London  |    7280.0000  |  3968.0000  |  29.0000  |  18.0000  |  28.0000  |  27.0000  |  20.0000  |  20.0000  |  24.0000  |  20.0000  |  17.0000  |  20.0000  |  25.0000  |  25.0000  |  14.0000  |  27.0000  |   9.0000  |   5.0000  |   8.0000  |  10.0000  |  12.0000  |  10.0000  |  20.0000  |  39.0000  |  50.0000  |  61.0000  |  68.0000  |   99.0000  |  113.0000  |  122.0000  |  102.0000  |  114.0000  |  114.0000  |  107.0000  |   99.0000  |   89.0000  |  101.0000  |   93.0000  |   84.0000  |   77.0000  |   73.0000  |   61.0000  |   78.0000  |  65.0000  |  57.0000  |  50.0000  |  75.0000  |  72.0000  |  56.0000  |  50.0000  |  45.0000  |  61.0000  |   46.0000  |  113.0000  |   70.0000  |  49.0000  |  85.0000  |  76.0000  |  59.0000  |  61.0000  |  55.0000  |  60.0000  |  45.0000  |  28.0000  |  31.0000  |  46.0000  |  40.0000  |  23.0000  |  26.0000  |  20.0000  |  25.0000  |  21.0000  |  24.0000  |  30.0000  |  21.0000  |  25.0000  |  29.0000  |  20.0000  |  18.0000  |  21.0000  |  17.0000  |  11.0000  |  17.0000  |  14.0000  |  13.0000  |   8.0000  |  15.0000  |   9.0000  |   6.0000  |   8.0000  |   4.0000  |  2.0000  |     14  |    3312.0000  |  28.0000  |  35.0000  |  30.0000  |  19.0000  |  21.0000  |  26.0000  |  15.0000  |  20.0000  |  13.0000  |  18.0000  |  17.0000  |  15.0000  |  17.0000  |   6.0000  |  19.0000  |  13.0000  |   5.0000  |  15.0000  |  35.0000  |  29.0000  |  35.0000  |  48.0000  |  52.0000  |  47.0000  |  67.0000  |  74.0000  |   84.0000  |  84.0000  |   83.0000  |   70.0000  |  115.0000  |  84.0000  |   94.0000  |  101.0000  |  63.0000  |  61.0000  |  57.0000  |  58.0000  |  62.0000  |  44.0000  |  47.0000  |  37.0000  |  28.0000  |  33.0000  |  60.0000  |  36.0000  |  47.0000  |  52.0000  |  45.0000  |  36.0000  |  38.0000  |  41.0000  |  63.0000  |  51.0000  |  54.0000  |  55.0000  |  37.0000  |  41.0000  |  40.0000  |  36.0000  |  30.0000  |  29.0000  |  30.0000  |  27.0000  |  23.0000  |  23.0000  |  28.0000  |  28.0000  |  25.0000  |  34.0000  |  25.0000  |  19.0000  |  24.0000  |  23.0000  |  31.0000  |  19.0000  |  25.0000  |  26.0000  |  10.0000  |  12.0000  |  14.0000  |  17.0000  |  22.0000  |  15.0000  |   9.0000  |  10.0000  |   7.0000  |  11.0000  |  26.0000  |  14.0000  |     20  |
 (2003,City of London)  |  2003  |  City of London  |    7115.0000  |  3892.0000  |  35.0000  |  24.0000  |  16.0000  |  22.0000  |  26.0000  |  17.0000  |  19.0000  |  24.0000  |  21.0000  |  21.0000  |  24.0000  |  25.0000  |  21.0000  |  10.0000  |  16.0000  |  10.0000  |   4.0000  |   5.0000  |  12.0000  |  12.0000  |  11.0000  |  19.0000  |  49.0000  |  60.0000  |  66.0000  |   80.0000  |  100.0000  |  118.0000  |  114.0000  |  105.0000  |  108.0000  |  105.0000  |   99.0000  |   94.0000  |   85.0000  |   97.0000  |   89.0000  |   82.0000  |   76.0000  |   69.0000  |   63.0000  |  74.0000  |  64.0000  |  57.0000  |  51.0000  |  75.0000  |  74.0000  |  56.0000  |  51.0000  |  39.0000  |   64.0000  |   44.0000  |  108.0000  |  65.0000  |  47.0000  |  80.0000  |  74.0000  |  56.0000  |  61.0000  |  55.0000  |  55.0000  |  44.0000  |  26.0000  |  30.0000  |  42.0000  |  36.0000  |  23.0000  |  24.0000  |  22.0000  |  22.0000  |  18.0000  |  23.0000  |  31.0000  |  18.0000  |  24.0000  |  27.0000  |  19.0000  |  17.0000  |  22.0000  |  15.0000  |  10.0000  |  16.0000  |  12.0000  |  10.0000  |   8.0000  |  14.0000  |   8.0000  |   6.0000  |   7.0000  |  2.0000  |     13  |    3223.0000  |  18.0000  |  25.0000  |  31.0000  |  29.0000  |  18.0000  |  21.0000  |  26.0000  |  14.0000  |  19.0000  |  12.0000  |  19.0000  |  13.0000  |  11.0000  |  12.0000  |   2.0000  |  16.0000  |   7.0000  |  12.0000  |  22.0000  |  31.0000  |  34.0000  |  37.0000  |  52.0000  |  61.0000  |  58.0000  |  85.0000  |   73.0000  |  86.0000  |   82.0000  |   85.0000  |   75.0000  |  99.0000  |   85.0000  |   89.0000  |  92.0000  |  60.0000  |  58.0000  |  45.0000  |  51.0000  |  53.0000  |  42.0000  |  47.0000  |  44.0000  |  29.0000  |  35.0000  |  59.0000  |  38.0000  |  41.0000  |  49.0000  |  39.0000  |  35.0000  |  40.0000  |  37.0000  |  61.0000  |  49.0000  |  53.0000  |  50.0000  |  35.0000  |  40.0000  |  34.0000  |  36.0000  |  30.0000  |  29.0000  |  30.0000  |  27.0000  |  24.0000  |  23.0000  |  28.0000  |  30.0000  |  25.0000  |  32.0000  |  24.0000  |  17.0000  |  23.0000  |  21.0000  |  30.0000  |  16.0000  |  23.0000  |  24.0000  |  10.0000  |  11.0000  |  14.0000  |  15.0000  |  16.0000  |  16.0000  |   9.0000  |   2.0000  |   5.0000  |  10.0000  |  22.0000  |     26  |
 (2004,City of London)  |  2004  |  City of London  |    7118.0000  |  3875.0000  |  28.0000  |  27.0000  |  25.0000  |  16.0000  |  20.0000  |  27.0000  |  17.0000  |  20.0000  |  31.0000  |  18.0000  |  22.0000  |  21.0000  |  22.0000  |  16.0000  |   4.0000  |  13.0000  |   8.0000  |   0.0000  |   2.0000  |  13.0000  |   9.0000  |  25.0000  |  26.0000  |  63.0000  |  70.0000  |   69.0000  |   89.0000  |  112.0000  |  115.0000  |  116.0000  |  100.0000  |   93.0000  |  102.0000  |   93.0000  |   86.0000  |   79.0000  |   99.0000  |   92.0000  |   88.0000  |   81.0000  |   73.0000  |  59.0000  |  65.0000  |  67.0000  |  58.0000  |  49.0000  |  76.0000  |  70.0000  |  55.0000  |  50.0000  |   44.0000  |   61.0000  |   45.0000  |  99.0000  |  65.0000  |  46.0000  |  77.0000  |  76.0000  |  55.0000  |  57.0000  |  53.0000  |  57.0000  |  43.0000  |  28.0000  |  32.0000  |  39.0000  |  34.0000  |  22.0000  |  25.0000  |  21.0000  |  22.0000  |  18.0000  |  20.0000  |  30.0000  |  16.0000  |  24.0000  |  28.0000  |  19.0000  |  14.0000  |  20.0000  |   9.0000  |  12.0000  |  14.0000  |  10.0000  |   8.0000  |   8.0000  |  15.0000  |   8.0000  |   5.0000  |  5.0000  |     12  |    3243.0000  |  31.0000  |  18.0000  |  20.0000  |  26.0000  |  25.0000  |  20.0000  |  25.0000  |  28.0000  |  14.0000  |  19.0000  |   7.0000  |  19.0000  |  10.0000  |   9.0000  |   9.0000  |   1.0000  |  13.0000  |  17.0000  |   9.0000  |  22.0000  |  38.0000  |  41.0000  |  47.0000  |  59.0000  |  79.0000  |  80.0000  |   91.0000  |  86.0000  |   79.0000  |   81.0000  |   79.0000  |  78.0000  |   91.0000  |   80.0000  |  87.0000  |  83.0000  |  56.0000  |  61.0000  |  47.0000  |  48.0000  |  55.0000  |  40.0000  |  45.0000  |  39.0000  |  30.0000  |  34.0000  |  59.0000  |  37.0000  |  39.0000  |  56.0000  |  38.0000  |  33.0000  |  38.0000  |  36.0000  |  60.0000  |  51.0000  |  52.0000  |  51.0000  |  34.0000  |  40.0000  |  35.0000  |  34.0000  |  28.0000  |  32.0000  |  28.0000  |  27.0000  |  25.0000  |  20.0000  |  29.0000  |  28.0000  |  24.0000  |  30.0000  |  24.0000  |  15.0000  |  21.0000  |  22.0000  |  29.0000  |  15.0000  |  23.0000  |  22.0000  |  12.0000  |  11.0000  |  12.0000  |  11.0000  |  12.0000  |  12.0000  |   7.0000  |   1.0000  |   3.0000  |   9.0000  |     42  |
 (2005,City of London)  |  2005  |  City of London  |    7131.0000  |  3869.0000  |  34.0000  |  25.0000  |  22.0000  |  23.0000  |  12.0000  |  19.0000  |  22.0000  |  19.0000  |  19.0000  |  31.0000  |  20.0000  |  21.0000  |  20.0000  |  19.0000  |   4.0000  |   3.0000  |  12.0000  |  10.0000  |   0.0000  |   7.0000  |   9.0000  |  16.0000  |  43.0000  |  40.0000  |  72.0000  |   93.0000  |   74.0000  |   89.0000  |  117.0000  |  113.0000  |  104.0000  |   88.0000  |   92.0000  |  109.0000  |   98.0000  |   77.0000  |   76.0000  |  103.0000  |   89.0000  |   78.0000  |   80.0000  |  68.0000  |  61.0000  |  69.0000  |  62.0000  |  58.0000  |  51.0000  |  82.0000  |  67.0000  |  58.0000  |   52.0000  |   42.0000  |   59.0000  |  50.0000  |  89.0000  |  67.0000  |  47.0000  |  73.0000  |  70.0000  |  55.0000  |  58.0000  |  50.0000  |  53.0000  |  42.0000  |  27.0000  |  30.0000  |  42.0000  |  31.0000  |  23.0000  |  24.0000  |  20.0000  |  17.0000  |  17.0000  |  19.0000  |  30.0000  |  15.0000  |  21.0000  |  27.0000  |  17.0000  |  14.0000  |  21.0000  |   8.0000  |  14.0000  |  12.0000  |   7.0000  |   7.0000  |   6.0000  |  14.0000  |   7.0000  |  2.0000  |     12  |    3262.0000  |  29.0000  |  29.0000  |  15.0000  |  15.0000  |  23.0000  |  25.0000  |  17.0000  |  23.0000  |  25.0000  |  14.0000  |  18.0000  |   7.0000  |  20.0000  |   7.0000  |   7.0000  |   6.0000  |   2.0000  |   7.0000  |  19.0000  |  15.0000  |  31.0000  |  43.0000  |  49.0000  |  50.0000  |  82.0000  |  76.0000  |   89.0000  |  89.0000  |   85.0000  |   76.0000  |   90.0000  |  76.0000  |   85.0000  |   91.0000  |  74.0000  |  80.0000  |  74.0000  |  60.0000  |  55.0000  |  52.0000  |  45.0000  |  52.0000  |  43.0000  |  47.0000  |  38.0000  |  34.0000  |  34.0000  |  55.0000  |  33.0000  |  38.0000  |  57.0000  |  38.0000  |  36.0000  |  39.0000  |  37.0000  |  58.0000  |  52.0000  |  55.0000  |  50.0000  |  34.0000  |  37.0000  |  35.0000  |  37.0000  |  26.0000  |  33.0000  |  30.0000  |  25.0000  |  24.0000  |  18.0000  |  27.0000  |  26.0000  |  20.0000  |  28.0000  |  22.0000  |  18.0000  |  21.0000  |  24.0000  |  26.0000  |  16.0000  |  21.0000  |  22.0000  |  10.0000  |  12.0000  |  11.0000  |  10.0000  |  12.0000  |   9.0000  |   2.0000  |   2.0000  |   3.0000  |     50  |
 (2006,City of London)  |  2006  |  City of London  |    7254.0000  |  3959.0000  |  26.0000  |  25.0000  |  26.0000  |  20.0000  |  18.0000  |  13.0000  |  16.0000  |  23.0000  |  22.0000  |  18.0000  |  30.0000  |  18.0000  |  20.0000  |  17.0000  |   7.0000  |   5.0000  |   5.0000  |  15.0000  |  12.0000  |   0.0000  |  12.0000  |  19.0000  |  32.0000  |  63.0000  |  63.0000  |   82.0000  |  109.0000  |   83.0000  |   99.0000  |  124.0000  |  114.0000  |  103.0000  |   83.0000  |   85.0000  |  116.0000  |   98.0000  |   77.0000  |   74.0000  |  107.0000  |   87.0000  |   75.0000  |  82.0000  |  68.0000  |  63.0000  |  69.0000  |  59.0000  |  62.0000  |  53.0000  |  83.0000  |  66.0000  |   60.0000  |   52.0000  |   48.0000  |  63.0000  |  48.0000  |  85.0000  |  67.0000  |  47.0000  |  68.0000  |  62.0000  |  56.0000  |  56.0000  |  48.0000  |  54.0000  |  40.0000  |  28.0000  |  26.0000  |  41.0000  |  31.0000  |  22.0000  |  23.0000  |  20.0000  |  14.0000  |  16.0000  |  19.0000  |  29.0000  |  17.0000  |  20.0000  |  28.0000  |  17.0000  |  14.0000  |  19.0000  |   6.0000  |  10.0000  |  12.0000  |   5.0000  |   4.0000  |   6.0000  |  12.0000  |  7.0000  |     13  |    3295.0000  |  28.0000  |  26.0000  |  31.0000  |  12.0000  |  17.0000  |  25.0000  |  23.0000  |  20.0000  |  22.0000  |  25.0000  |  14.0000  |  18.0000  |   5.0000  |  19.0000  |   4.0000  |   7.0000  |   4.0000  |  12.0000  |   7.0000  |  27.0000  |  24.0000  |  33.0000  |  51.0000  |  58.0000  |  71.0000  |  88.0000  |   80.0000  |  86.0000  |   86.0000  |   92.0000  |   84.0000  |  86.0000  |   78.0000  |   84.0000  |  80.0000  |  77.0000  |  74.0000  |  68.0000  |  62.0000  |  45.0000  |  53.0000  |  45.0000  |  51.0000  |  45.0000  |  46.0000  |  39.0000  |  38.0000  |  33.0000  |  53.0000  |  31.0000  |  37.0000  |  57.0000  |  39.0000  |  36.0000  |  38.0000  |  36.0000  |  56.0000  |  50.0000  |  53.0000  |  47.0000  |  30.0000  |  41.0000  |  31.0000  |  34.0000  |  24.0000  |  30.0000  |  29.0000  |  23.0000  |  26.0000  |  17.0000  |  27.0000  |  26.0000  |  20.0000  |  26.0000  |  24.0000  |  18.0000  |  20.0000  |  22.0000  |  27.0000  |  17.0000  |  20.0000  |  19.0000  |  11.0000  |  11.0000  |  10.0000  |   9.0000  |  11.0000  |   9.0000  |   2.0000  |   0.0000  |     45  |
 (2007,City of London)  |  2007  |  City of London  |    7607.0000  |  4197.0000  |  31.0000  |  25.0000  |  24.0000  |  22.0000  |  23.0000  |  16.0000  |  13.0000  |  14.0000  |  27.0000  |  23.0000  |  15.0000  |  33.0000  |  16.0000  |  19.0000  |   7.0000  |   7.0000  |   3.0000  |   9.0000  |  16.0000  |  27.0000  |   0.0000  |  30.0000  |  35.0000  |  64.0000  |  91.0000  |   90.0000  |  113.0000  |  123.0000  |   99.0000  |  107.0000  |  123.0000  |  102.0000  |  106.0000  |   84.0000  |   87.0000  |  114.0000  |  104.0000  |   86.0000  |   83.0000  |  117.0000  |   88.0000  |  79.0000  |  74.0000  |  70.0000  |  75.0000  |  74.0000  |  63.0000  |  64.0000  |  57.0000  |  80.0000  |   65.0000  |   62.0000  |   55.0000  |  51.0000  |  64.0000  |  53.0000  |  78.0000  |  64.0000  |  48.0000  |  63.0000  |  59.0000  |  54.0000  |  58.0000  |  46.0000  |  54.0000  |  36.0000  |  26.0000  |  30.0000  |  39.0000  |  30.0000  |  22.0000  |  23.0000  |  17.0000  |  16.0000  |  16.0000  |  19.0000  |  27.0000  |  15.0000  |  15.0000  |  29.0000  |  14.0000  |  14.0000  |  18.0000  |   6.0000  |   6.0000  |  10.0000  |   4.0000  |   4.0000  |   6.0000  |  9.0000  |     20  |    3410.0000  |  24.0000  |  24.0000  |  30.0000  |  25.0000  |  17.0000  |  17.0000  |  17.0000  |  21.0000  |  16.0000  |  21.0000  |  25.0000  |  15.0000  |  18.0000  |   4.0000  |  19.0000  |   3.0000  |  11.0000  |  24.0000  |  15.0000  |  24.0000  |  39.0000  |  34.0000  |  56.0000  |  70.0000  |  75.0000  |  91.0000  |  100.0000  |  85.0000  |  101.0000  |   83.0000  |   80.0000  |  76.0000  |   80.0000  |   72.0000  |  72.0000  |  72.0000  |  76.0000  |  73.0000  |  62.0000  |  65.0000  |  47.0000  |  56.0000  |  48.0000  |  55.0000  |  50.0000  |  49.0000  |  43.0000  |  36.0000  |  30.0000  |  48.0000  |  29.0000  |  38.0000  |  54.0000  |  41.0000  |  39.0000  |  39.0000  |  39.0000  |  56.0000  |  52.0000  |  53.0000  |  46.0000  |  27.0000  |  41.0000  |  35.0000  |  32.0000  |  27.0000  |  30.0000  |  32.0000  |  22.0000  |  24.0000  |  16.0000  |  27.0000  |  26.0000  |  18.0000  |  25.0000  |  23.0000  |  17.0000  |  18.0000  |  22.0000  |  23.0000  |  17.0000  |  17.0000  |  19.0000  |  11.0000  |  10.0000  |  10.0000  |   7.0000  |   9.0000  |   8.0000  |   1.0000  |     36  |
 (2008,City of London)  |  2008  |  City of London  |    7429.0000  |  4131.0000  |  29.0000  |  26.0000  |  22.0000  |  24.0000  |  18.0000  |  22.0000  |  13.0000  |  12.0000  |  17.0000  |  30.0000  |  20.0000  |  15.0000  |  30.0000  |  17.0000  |  10.0000  |   8.0000  |   6.0000  |   7.0000  |  11.0000  |  18.0000  |  28.0000  |  11.0000  |  43.0000  |  39.0000  |  75.0000  |  100.0000  |   85.0000  |  123.0000  |  122.0000  |  102.0000  |   93.0000  |  111.0000  |   96.0000  |  101.0000  |   75.0000  |   80.0000  |  103.0000  |   92.0000  |   83.0000  |   79.0000  |  121.0000  |  86.0000  |  79.0000  |  69.0000  |  70.0000  |  66.0000  |  77.0000  |  57.0000  |  67.0000  |  67.0000  |   81.0000  |   64.0000  |   61.0000  |  51.0000  |  52.0000  |  61.0000  |  55.0000  |  73.0000  |  61.0000  |  46.0000  |  60.0000  |  61.0000  |  53.0000  |  55.0000  |  42.0000  |  53.0000  |  34.0000  |  26.0000  |  29.0000  |  39.0000  |  29.0000  |  24.0000  |  22.0000  |  17.0000  |  15.0000  |  14.0000  |  19.0000  |  24.0000  |  14.0000  |  16.0000  |  27.0000  |  13.0000  |  12.0000  |  17.0000  |   6.0000  |   6.0000  |   7.0000  |   4.0000  |   3.0000  |  5.0000  |     25  |    3298.0000  |  12.0000  |  17.0000  |  23.0000  |  23.0000  |  24.0000  |  16.0000  |  17.0000  |  16.0000  |  19.0000  |  15.0000  |  21.0000  |  24.0000  |  15.0000  |  19.0000  |   1.0000  |  19.0000  |   0.0000  |  22.0000  |  26.0000  |  25.0000  |  35.0000  |  43.0000  |  35.0000  |  57.0000  |  73.0000  |  82.0000  |   89.0000  |  95.0000  |   88.0000  |   94.0000  |   76.0000  |  77.0000  |   68.0000  |   69.0000  |  57.0000  |  60.0000  |  61.0000  |  64.0000  |  68.0000  |  57.0000  |  63.0000  |  41.0000  |  52.0000  |  46.0000  |  52.0000  |  50.0000  |  50.0000  |  37.0000  |  35.0000  |  32.0000  |  42.0000  |  29.0000  |  38.0000  |  53.0000  |  40.0000  |  42.0000  |  42.0000  |  38.0000  |  52.0000  |  51.0000  |  51.0000  |  48.0000  |  27.0000  |  41.0000  |  34.0000  |  29.0000  |  30.0000  |  31.0000  |  29.0000  |  23.0000  |  22.0000  |  16.0000  |  28.0000  |  27.0000  |  20.0000  |  24.0000  |  22.0000  |  16.0000  |  15.0000  |  22.0000  |  24.0000  |  15.0000  |  17.0000  |  18.0000  |  10.0000  |   9.0000  |   9.0000  |   7.0000  |   9.0000  |   8.0000  |     30  |

Row / Column Access

Random Access

Random access to specific rows or columns can be achieved in O(1) time using either the ordinal or the key for the row or column in question. Convenience functions to access the first and last row / column vectors is also provided via a first() and last() method. Each call to rowAt() or colAt() creates a new row or column vector respectively, so iterating over the frame in this way is unlikely to be as fast as the forEach() technique described above.

//Load ONS dataset
final DataFrame<Tuple,String> frame = loadPopulationDataset();

//Random access to a row by ordinal or key
DataFrameRow<Tuple,String> row1 = frame.rowAt(4);
DataFrameRow<Tuple,String> row2 = frame.rowAt(Tuple.of(2003, "City of London"));

//Random access to a column by ordinal or key
DataFrameColumn<Tuple,String> column1 = frame.colAt(2);
DataFrameColumn<Tuple,String> column2 = frame.colAt("All Persons");

//Access first and last rows
Optional<DataFrameRow<Tuple,String>> firstRow = frame.rows().first();
Optional<DataFrameRow<Tuple,String>> lastRow = frame.rows().last();

//Access first and last columns
Optional<DataFrameColumn<Tuple,String>> firstColumn = frame.cols().first();
Optional<DataFrameColumn<Tuple,String>> lastColumn = frame.cols().last();

The example below is slightly more elaborate where we access the "All Persons" column in the ONS DataFrame in order to locate the row which contains the largest population value by using the max() function. Before we do this however, we access the largest value using the stats().max() function so we can assert the max() points us to a row with a matching value - a nice unit test.

// Find row with max value for "All Persons: column using column key
final double expectedMax = frame.colAt("All Persons").stats().max();
frame.colAt("All Persons").max().ifPresent(value -> {
    final DataFrameRow<Tuple,String> row = frame.rowAt(value.rowKey());
    final double actualMax = row.getDouble("All Persons");
    Asserts.assertEquals(actualMax, expectedMax, "The max values match");
});

Iteration

The DataFrame API is entirely symmetric in the row and column axis, so everything that you can do in the row dimension you can also do in the column dimension. Some of the examples below operate on either the row or column axis simply for brevity, but you can assume there is a direct analogue in the other dimension.

Iterating over the rows or columns of a DataFrame is a common operation, so Morpehus provides a simple API to do this efficiently, both via sequential and parallel execution. Rather than creating a new row or column object for each item in the iteration, Morpheus presents the same proxy object which points at the appropriate row or column, thus reducing the burden on the garbage collector. This means you cannot collect rows or columns, unless you call copy() on them to create a detached view on the row or column vector. This is generally discouraged, especially for large frames as it would likely be inefficient both from a memory consumption and garbage collection perspective.

The code below uses the ONS dataset described in the introduction and shows one of several ways we could convert the male and female population counts into percentages by gender (for example, in the City of London in 1999, 24 out of 3519 males were 0 years old (column M 0), making it 24 / 3519 = 0.6820%). The first code example illustrates how to iterate over each row sequentially, then for each row we iterate over all values and modify those that represent a male or female count with a percentage value. Note how we avoid any boxing / unboxing of primitives by using type specific getters and setters when accessing what we know to be double precision values (since the CSV parsing was setup that way).

//Sequential: Convert male & female population counts into weights
frame.rows().forEach(row -> row.forEach(value -> {
    if (value.colKey().matches("M\\s+\\d+")) {
        double totalMales = value.row().getDouble("All Males");
        double count = value.getDouble();
        value.setDouble(count / totalMales);
    } else if (value.colKey().matches("F\\s+\\d+")) {
        double totalFemales = value.row().getDouble("All Females");
        double count = value.getDouble();
        value.setDouble(count / totalFemales);
    }
}));

//Print frame to std out with custom formatting
frame.out().print(formats -> {
    formats.withDecimalFormat("All Persons", "0;-0", 1);
    formats.withDecimalFormat("All Males", "0;-0", 1);
    formats.withDecimalFormat("All Females", "0;-0", 1);
    formats.withDecimalFormat(Double.class, "0.00'%';-0.00'%'", 100);
});
         Index          |  Year  |     Borough      |  All Persons  |  All Males  |   M 0   |   M 1   |   M 2   |   M 3   |   M 4   |   M 5   |   M 6   |   M 7   |   M 8   |   M 9   |  M 10   |  M 11   |  M 12   |  M 13   |  M 14   |  M 15   |  M 16   |  M 17   |  M 18   |  M 19   |  M 20   |  M 21   |  M 22   |  M 23   |  M 24   |  M 25   |  M 26   |  M 27   |  M 28   |  M 29   |  M 30   |  M 31   |  M 32   |  M 33   |  M 34   |  M 35   |  M 36   |  M 37   |  M 38   |  M 39   |  M 40   |  M 41   |  M 42   |  M 43   |  M 44   |  M 45   |  M 46   |  M 47   |  M 48   |  M 49   |  M 50   |  M 51   |  M 52   |  M 53   |  M 54   |  M 55   |  M 56   |  M 57   |  M 58   |  M 59   |  M 60   |  M 61   |  M 62   |  M 63   |  M 64   |  M 65   |  M 66   |  M 67   |  M 68   |  M 69   |  M 70   |  M 71   |  M 72   |  M 73   |  M 74   |  M 75   |  M 76   |  M 77   |  M 78   |  M 79   |  M 80   |  M 81   |  M 82   |  M 83   |  M 84   |  M 85   |  M 86   |  M 87   |  M 88   |  M 89   |  M 90+  |  All Females  |   F 0   |   F 1   |   F 2   |   F 3   |   F 4   |   F 5   |   F 6   |   F 7   |   F 8   |   F 9   |  F 10   |  F 11   |  F 12   |  F 13   |  F 14   |  F 15   |  F 16   |  F 17   |  F 18   |  F 19   |  F 20   |  F 21   |  F 22   |  F 23   |  F 24   |  F 25   |  F 26   |  F 27   |  F 28   |  F 29   |  F 30   |  F 31   |  F 32   |  F 33   |  F 34   |  F 35   |  F 36   |  F 37   |  F 38   |  F 39   |  F 40   |  F 41   |  F 42   |  F 43   |  F 44   |  F 45   |  F 46   |  F 47   |  F 48   |  F 49   |  F 50   |  F 51   |  F 52   |  F 53   |  F 54   |  F 55   |  F 56   |  F 57   |  F 58   |  F 59   |  F 60   |  F 61   |  F 62   |  F 63   |  F 64   |  F 65   |  F 66   |  F 67   |  F 68   |  F 69   |  F 70   |  F 71   |  F 72   |  F 73   |  F 74   |  F 75   |  F 76   |  F 77   |  F 78   |  F 79   |  F 80   |  F 81   |  F 82   |  F 83   |  F 84   |  F 85   |  F 86   |  F 87   |  F 88   |  F 89   |  F 90+  |
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 (1999,City of London)  |  1999  |  City of London  |         6581  |       3519  |  0.68%  |  0.65%  |  0.63%  |  0.60%  |  0.57%  |  0.60%  |  0.57%  |  0.60%  |  0.57%  |  0.63%  |  0.63%  |  0.60%  |  0.54%  |  0.51%  |  0.48%  |  0.48%  |  0.48%  |  0.60%  |  0.74%  |  0.91%  |  1.14%  |  1.34%  |  1.48%  |  1.71%  |  1.85%  |  1.99%  |  2.07%  |  2.07%  |  2.07%  |  2.22%  |  2.22%  |  2.19%  |  2.13%  |  2.05%  |  2.02%  |  2.02%  |  1.85%  |  1.71%  |  1.65%  |  1.65%  |  1.62%  |  1.56%  |  1.45%  |  1.51%  |  1.51%  |  1.68%  |  1.68%  |  1.71%  |  1.85%  |  1.93%  |  1.93%  |  1.99%  |  1.79%  |  1.76%  |  1.73%  |  1.53%  |  1.39%  |  1.34%  |  1.22%  |  1.08%  |  0.99%  |  0.97%  |  0.97%  |  0.94%  |  0.91%  |  0.88%  |  0.91%  |  0.88%  |  0.85%  |  0.85%  |  0.82%  |  0.77%  |  0.74%  |  0.68%  |  0.65%  |  0.57%  |  0.57%  |  0.51%  |  0.48%  |  0.43%  |  0.40%  |  0.34%  |  0.34%  |  0.31%  |  0.31%  |  1.22%  |    NaN  |    NaN  |    NaN  |    NaN  |      0  |         3062  |  0.78%  |  0.78%  |  0.72%  |  0.72%  |  0.69%  |  0.69%  |  0.62%  |  0.62%  |  0.59%  |  0.59%  |  0.59%  |  0.52%  |  0.56%  |  0.52%  |  0.52%  |  0.52%  |  0.65%  |  0.82%  |  0.85%  |  0.98%  |  1.27%  |  1.53%  |  1.63%  |  1.76%  |  1.99%  |  2.22%  |  2.32%  |  2.35%  |  2.32%  |  2.38%  |  2.32%  |  2.22%  |  2.16%  |  2.02%  |  1.80%  |  1.67%  |  1.53%  |  1.40%  |  1.37%  |  1.27%  |  1.27%  |  1.34%  |  1.37%  |  1.40%  |  1.44%  |  1.31%  |  1.44%  |  1.47%  |  1.53%  |  1.57%  |  1.60%  |  1.60%  |  1.63%  |  1.50%  |  1.44%  |  1.27%  |  1.18%  |  1.11%  |  1.08%  |  1.01%  |  0.98%  |  0.95%  |  0.95%  |  0.98%  |  1.01%  |  0.98%  |  0.98%  |  0.95%  |  0.95%  |  0.91%  |  0.85%  |  0.85%  |  0.82%  |  0.75%  |  0.69%  |  0.65%  |  0.65%  |  0.62%  |  0.56%  |  0.56%  |  0.56%  |  0.52%  |  0.49%  |  0.46%  |  0.42%  |  2.48%  |    NaN  |    NaN  |    NaN  |    NaN  |      0  |
 (2000,City of London)  |  2000  |  City of London  |         7014  |       3775  |  0.66%  |  0.66%  |  0.64%  |  0.61%  |  0.58%  |  0.56%  |  0.58%  |  0.56%  |  0.58%  |  0.56%  |  0.58%  |  0.53%  |  0.48%  |  0.42%  |  0.42%  |  0.40%  |  0.45%  |  0.50%  |  0.64%  |  0.79%  |  1.03%  |  1.27%  |  1.51%  |  1.70%  |  1.91%  |  2.15%  |  2.33%  |  2.38%  |  2.38%  |  2.41%  |  2.49%  |  2.49%  |  2.38%  |  2.28%  |  2.15%  |  2.12%  |  2.01%  |  1.85%  |  1.72%  |  1.64%  |  1.64%  |  1.64%  |  1.56%  |  1.48%  |  1.48%  |  1.48%  |  1.64%  |  1.64%  |  1.64%  |  1.77%  |  1.88%  |  1.88%  |  1.96%  |  1.75%  |  1.70%  |  1.67%  |  1.48%  |  1.32%  |  1.25%  |  1.14%  |  1.03%  |  0.90%  |  0.85%  |  0.82%  |  0.79%  |  0.77%  |  0.74%  |  0.74%  |  0.72%  |  0.74%  |  0.72%  |  0.69%  |  0.66%  |  0.61%  |  0.58%  |  0.58%  |  0.50%  |  0.50%  |  0.45%  |  0.42%  |  0.40%  |  0.37%  |  0.32%  |  0.32%  |  0.29%  |  1.03%  |    NaN  |    NaN  |    NaN  |    NaN  |      0  |         3239  |  0.80%  |  0.74%  |  0.74%  |  0.68%  |  0.65%  |  0.65%  |  0.62%  |  0.59%  |  0.59%  |  0.59%  |  0.59%  |  0.56%  |  0.52%  |  0.56%  |  0.52%  |  0.56%  |  0.62%  |  0.71%  |  0.86%  |  0.99%  |  1.17%  |  1.51%  |  1.79%  |  1.88%  |  2.13%  |  2.32%  |  2.53%  |  2.56%  |  2.59%  |  2.50%  |  2.47%  |  2.35%  |  2.25%  |  2.13%  |  1.98%  |  1.76%  |  1.64%  |  1.48%  |  1.36%  |  1.33%  |  1.27%  |  1.30%  |  1.27%  |  1.33%  |  1.33%  |  1.36%  |  1.27%  |  1.39%  |  1.39%  |  1.45%  |  1.51%  |  1.54%  |  1.57%  |  1.57%  |  1.45%  |  1.39%  |  1.27%  |  1.14%  |  1.08%  |  0.99%  |  0.93%  |  0.90%  |  0.86%  |  0.83%  |  0.86%  |  0.90%  |  0.86%  |  0.86%  |  0.86%  |  0.86%  |  0.83%  |  0.77%  |  0.77%  |  0.74%  |  0.68%  |  0.65%  |  0.59%  |  0.62%  |  0.59%  |  0.52%  |  0.49%  |  0.46%  |  0.46%  |  0.46%  |  0.40%  |  2.50%  |    NaN  |    NaN  |    NaN  |    NaN  |      0  |
 (2001,City of London)  |  2001  |  City of London  |         7359  |       3984  |  0.43%  |  0.75%  |  0.63%  |  0.48%  |  0.53%  |  0.63%  |  0.50%  |  0.40%  |  0.48%  |  0.68%  |  0.65%  |  0.40%  |  0.73%  |  0.48%  |  0.28%  |  0.35%  |  0.30%  |  0.33%  |  0.30%  |  0.68%  |  0.95%  |  0.98%  |  1.33%  |  1.58%  |  2.01%  |  2.76%  |  2.76%  |  2.51%  |  2.71%  |  3.14%  |  2.86%  |  2.38%  |  2.33%  |  2.64%  |  2.48%  |  2.11%  |  2.23%  |  1.78%  |  1.58%  |  1.88%  |  1.63%  |  1.31%  |  1.18%  |  1.91%  |  1.83%  |  1.36%  |  1.23%  |  1.13%  |  1.51%  |  1.23%  |  2.79%  |  1.83%  |  1.38%  |  2.03%  |  2.01%  |  1.53%  |  1.58%  |  1.41%  |  1.61%  |  1.20%  |  0.70%  |  0.85%  |  1.13%  |  0.90%  |  0.63%  |  0.70%  |  0.53%  |  0.70%  |  0.53%  |  0.68%  |  0.68%  |  0.53%  |  0.60%  |  0.73%  |  0.53%  |  0.48%  |  0.58%  |  0.50%  |  0.28%  |  0.48%  |  0.38%  |  0.35%  |  0.20%  |  0.38%  |  0.25%  |  0.15%  |  0.25%  |  0.13%  |  0.10%  |  0.08%  |     13  |         3375  |  0.95%  |  0.89%  |  0.68%  |  0.62%  |  0.77%  |  0.47%  |  0.62%  |  0.44%  |  0.53%  |  0.71%  |  0.59%  |  0.59%  |  0.30%  |  0.77%  |  0.39%  |  0.39%  |  0.41%  |  1.16%  |  0.83%  |  1.04%  |  1.39%  |  1.16%  |  1.45%  |  1.60%  |  2.19%  |  2.76%  |  2.64%  |  2.37%  |  2.49%  |  3.17%  |  2.52%  |  2.46%  |  2.99%  |  1.96%  |  1.78%  |  1.60%  |  1.96%  |  1.78%  |  1.42%  |  1.33%  |  1.10%  |  0.83%  |  0.92%  |  1.87%  |  1.27%  |  1.57%  |  1.48%  |  1.39%  |  1.04%  |  1.24%  |  1.10%  |  1.93%  |  1.42%  |  1.69%  |  1.69%  |  1.13%  |  1.33%  |  1.13%  |  1.13%  |  0.98%  |  0.95%  |  0.95%  |  0.77%  |  0.74%  |  0.71%  |  0.86%  |  0.83%  |  0.80%  |  1.01%  |  0.80%  |  0.59%  |  0.77%  |  0.71%  |  0.92%  |  0.53%  |  0.71%  |  0.80%  |  0.39%  |  0.39%  |  0.44%  |  0.53%  |  0.65%  |  0.53%  |  0.33%  |  0.30%  |  0.30%  |  0.41%  |  0.77%  |  0.47%  |  0.21%  |     15  |
 (2002,City of London)  |  2002  |  City of London  |         7280  |       3968  |  0.73%  |  0.45%  |  0.71%  |  0.68%  |  0.50%  |  0.50%  |  0.60%  |  0.50%  |  0.43%  |  0.50%  |  0.63%  |  0.63%  |  0.35%  |  0.68%  |  0.23%  |  0.13%  |  0.20%  |  0.25%  |  0.30%  |  0.25%  |  0.50%  |  0.98%  |  1.26%  |  1.54%  |  1.71%  |  2.49%  |  2.85%  |  3.07%  |  2.57%  |  2.87%  |  2.87%  |  2.70%  |  2.49%  |  2.24%  |  2.55%  |  2.34%  |  2.12%  |  1.94%  |  1.84%  |  1.54%  |  1.97%  |  1.64%  |  1.44%  |  1.26%  |  1.89%  |  1.81%  |  1.41%  |  1.26%  |  1.13%  |  1.54%  |  1.16%  |  2.85%  |  1.76%  |  1.23%  |  2.14%  |  1.92%  |  1.49%  |  1.54%  |  1.39%  |  1.51%  |  1.13%  |  0.71%  |  0.78%  |  1.16%  |  1.01%  |  0.58%  |  0.66%  |  0.50%  |  0.63%  |  0.53%  |  0.60%  |  0.76%  |  0.53%  |  0.63%  |  0.73%  |  0.50%  |  0.45%  |  0.53%  |  0.43%  |  0.28%  |  0.43%  |  0.35%  |  0.33%  |  0.20%  |  0.38%  |  0.23%  |  0.15%  |  0.20%  |  0.10%  |  0.05%  |     14  |         3312  |  0.85%  |  1.06%  |  0.91%  |  0.57%  |  0.63%  |  0.79%  |  0.45%  |  0.60%  |  0.39%  |  0.54%  |  0.51%  |  0.45%  |  0.51%  |  0.18%  |  0.57%  |  0.39%  |  0.15%  |  0.45%  |  1.06%  |  0.88%  |  1.06%  |  1.45%  |  1.57%  |  1.42%  |  2.02%  |  2.23%  |  2.54%  |  2.54%  |  2.51%  |  2.11%  |  3.47%  |  2.54%  |  2.84%  |  3.05%  |  1.90%  |  1.84%  |  1.72%  |  1.75%  |  1.87%  |  1.33%  |  1.42%  |  1.12%  |  0.85%  |  1.00%  |  1.81%  |  1.09%  |  1.42%  |  1.57%  |  1.36%  |  1.09%  |  1.15%  |  1.24%  |  1.90%  |  1.54%  |  1.63%  |  1.66%  |  1.12%  |  1.24%  |  1.21%  |  1.09%  |  0.91%  |  0.88%  |  0.91%  |  0.82%  |  0.69%  |  0.69%  |  0.85%  |  0.85%  |  0.75%  |  1.03%  |  0.75%  |  0.57%  |  0.72%  |  0.69%  |  0.94%  |  0.57%  |  0.75%  |  0.79%  |  0.30%  |  0.36%  |  0.42%  |  0.51%  |  0.66%  |  0.45%  |  0.27%  |  0.30%  |  0.21%  |  0.33%  |  0.79%  |  0.42%  |     20  |
 (2003,City of London)  |  2003  |  City of London  |         7115  |       3892  |  0.90%  |  0.62%  |  0.41%  |  0.57%  |  0.67%  |  0.44%  |  0.49%  |  0.62%  |  0.54%  |  0.54%  |  0.62%  |  0.64%  |  0.54%  |  0.26%  |  0.41%  |  0.26%  |  0.10%  |  0.13%  |  0.31%  |  0.31%  |  0.28%  |  0.49%  |  1.26%  |  1.54%  |  1.70%  |  2.06%  |  2.57%  |  3.03%  |  2.93%  |  2.70%  |  2.77%  |  2.70%  |  2.54%  |  2.42%  |  2.18%  |  2.49%  |  2.29%  |  2.11%  |  1.95%  |  1.77%  |  1.62%  |  1.90%  |  1.64%  |  1.46%  |  1.31%  |  1.93%  |  1.90%  |  1.44%  |  1.31%  |  1.00%  |  1.64%  |  1.13%  |  2.77%  |  1.67%  |  1.21%  |  2.06%  |  1.90%  |  1.44%  |  1.57%  |  1.41%  |  1.41%  |  1.13%  |  0.67%  |  0.77%  |  1.08%  |  0.92%  |  0.59%  |  0.62%  |  0.57%  |  0.57%  |  0.46%  |  0.59%  |  0.80%  |  0.46%  |  0.62%  |  0.69%  |  0.49%  |  0.44%  |  0.57%  |  0.39%  |  0.26%  |  0.41%  |  0.31%  |  0.26%  |  0.21%  |  0.36%  |  0.21%  |  0.15%  |  0.18%  |  0.05%  |     13  |         3223  |  0.56%  |  0.78%  |  0.96%  |  0.90%  |  0.56%  |  0.65%  |  0.81%  |  0.43%  |  0.59%  |  0.37%  |  0.59%  |  0.40%  |  0.34%  |  0.37%  |  0.06%  |  0.50%  |  0.22%  |  0.37%  |  0.68%  |  0.96%  |  1.05%  |  1.15%  |  1.61%  |  1.89%  |  1.80%  |  2.64%  |  2.26%  |  2.67%  |  2.54%  |  2.64%  |  2.33%  |  3.07%  |  2.64%  |  2.76%  |  2.85%  |  1.86%  |  1.80%  |  1.40%  |  1.58%  |  1.64%  |  1.30%  |  1.46%  |  1.37%  |  0.90%  |  1.09%  |  1.83%  |  1.18%  |  1.27%  |  1.52%  |  1.21%  |  1.09%  |  1.24%  |  1.15%  |  1.89%  |  1.52%  |  1.64%  |  1.55%  |  1.09%  |  1.24%  |  1.05%  |  1.12%  |  0.93%  |  0.90%  |  0.93%  |  0.84%  |  0.74%  |  0.71%  |  0.87%  |  0.93%  |  0.78%  |  0.99%  |  0.74%  |  0.53%  |  0.71%  |  0.65%  |  0.93%  |  0.50%  |  0.71%  |  0.74%  |  0.31%  |  0.34%  |  0.43%  |  0.47%  |  0.50%  |  0.50%  |  0.28%  |  0.06%  |  0.16%  |  0.31%  |  0.68%  |     26  |
 (2004,City of London)  |  2004  |  City of London  |         7118  |       3875  |  0.72%  |  0.70%  |  0.65%  |  0.41%  |  0.52%  |  0.70%  |  0.44%  |  0.52%  |  0.80%  |  0.46%  |  0.57%  |  0.54%  |  0.57%  |  0.41%  |  0.10%  |  0.34%  |  0.21%  |  0.00%  |  0.05%  |  0.34%  |  0.23%  |  0.65%  |  0.67%  |  1.63%  |  1.81%  |  1.78%  |  2.30%  |  2.89%  |  2.97%  |  2.99%  |  2.58%  |  2.40%  |  2.63%  |  2.40%  |  2.22%  |  2.04%  |  2.55%  |  2.37%  |  2.27%  |  2.09%  |  1.88%  |  1.52%  |  1.68%  |  1.73%  |  1.50%  |  1.26%  |  1.96%  |  1.81%  |  1.42%  |  1.29%  |  1.14%  |  1.57%  |  1.16%  |  2.55%  |  1.68%  |  1.19%  |  1.99%  |  1.96%  |  1.42%  |  1.47%  |  1.37%  |  1.47%  |  1.11%  |  0.72%  |  0.83%  |  1.01%  |  0.88%  |  0.57%  |  0.65%  |  0.54%  |  0.57%  |  0.46%  |  0.52%  |  0.77%  |  0.41%  |  0.62%  |  0.72%  |  0.49%  |  0.36%  |  0.52%  |  0.23%  |  0.31%  |  0.36%  |  0.26%  |  0.21%  |  0.21%  |  0.39%  |  0.21%  |  0.13%  |  0.13%  |     12  |         3243  |  0.96%  |  0.56%  |  0.62%  |  0.80%  |  0.77%  |  0.62%  |  0.77%  |  0.86%  |  0.43%  |  0.59%  |  0.22%  |  0.59%  |  0.31%  |  0.28%  |  0.28%  |  0.03%  |  0.40%  |  0.52%  |  0.28%  |  0.68%  |  1.17%  |  1.26%  |  1.45%  |  1.82%  |  2.44%  |  2.47%  |  2.81%  |  2.65%  |  2.44%  |  2.50%  |  2.44%  |  2.41%  |  2.81%  |  2.47%  |  2.68%  |  2.56%  |  1.73%  |  1.88%  |  1.45%  |  1.48%  |  1.70%  |  1.23%  |  1.39%  |  1.20%  |  0.93%  |  1.05%  |  1.82%  |  1.14%  |  1.20%  |  1.73%  |  1.17%  |  1.02%  |  1.17%  |  1.11%  |  1.85%  |  1.57%  |  1.60%  |  1.57%  |  1.05%  |  1.23%  |  1.08%  |  1.05%  |  0.86%  |  0.99%  |  0.86%  |  0.83%  |  0.77%  |  0.62%  |  0.89%  |  0.86%  |  0.74%  |  0.93%  |  0.74%  |  0.46%  |  0.65%  |  0.68%  |  0.89%  |  0.46%  |  0.71%  |  0.68%  |  0.37%  |  0.34%  |  0.37%  |  0.34%  |  0.37%  |  0.37%  |  0.22%  |  0.03%  |  0.09%  |  0.28%  |     42  |
 (2005,City of London)  |  2005  |  City of London  |         7131  |       3869  |  0.88%  |  0.65%  |  0.57%  |  0.59%  |  0.31%  |  0.49%  |  0.57%  |  0.49%  |  0.49%  |  0.80%  |  0.52%  |  0.54%  |  0.52%  |  0.49%  |  0.10%  |  0.08%  |  0.31%  |  0.26%  |  0.00%  |  0.18%  |  0.23%  |  0.41%  |  1.11%  |  1.03%  |  1.86%  |  2.40%  |  1.91%  |  2.30%  |  3.02%  |  2.92%  |  2.69%  |  2.27%  |  2.38%  |  2.82%  |  2.53%  |  1.99%  |  1.96%  |  2.66%  |  2.30%  |  2.02%  |  2.07%  |  1.76%  |  1.58%  |  1.78%  |  1.60%  |  1.50%  |  1.32%  |  2.12%  |  1.73%  |  1.50%  |  1.34%  |  1.09%  |  1.52%  |  1.29%  |  2.30%  |  1.73%  |  1.21%  |  1.89%  |  1.81%  |  1.42%  |  1.50%  |  1.29%  |  1.37%  |  1.09%  |  0.70%  |  0.78%  |  1.09%  |  0.80%  |  0.59%  |  0.62%  |  0.52%  |  0.44%  |  0.44%  |  0.49%  |  0.78%  |  0.39%  |  0.54%  |  0.70%  |  0.44%  |  0.36%  |  0.54%  |  0.21%  |  0.36%  |  0.31%  |  0.18%  |  0.18%  |  0.16%  |  0.36%  |  0.18%  |  0.05%  |     12  |         3262  |  0.89%  |  0.89%  |  0.46%  |  0.46%  |  0.71%  |  0.77%  |  0.52%  |  0.71%  |  0.77%  |  0.43%  |  0.55%  |  0.21%  |  0.61%  |  0.21%  |  0.21%  |  0.18%  |  0.06%  |  0.21%  |  0.58%  |  0.46%  |  0.95%  |  1.32%  |  1.50%  |  1.53%  |  2.51%  |  2.33%  |  2.73%  |  2.73%  |  2.61%  |  2.33%  |  2.76%  |  2.33%  |  2.61%  |  2.79%  |  2.27%  |  2.45%  |  2.27%  |  1.84%  |  1.69%  |  1.59%  |  1.38%  |  1.59%  |  1.32%  |  1.44%  |  1.16%  |  1.04%  |  1.04%  |  1.69%  |  1.01%  |  1.16%  |  1.75%  |  1.16%  |  1.10%  |  1.20%  |  1.13%  |  1.78%  |  1.59%  |  1.69%  |  1.53%  |  1.04%  |  1.13%  |  1.07%  |  1.13%  |  0.80%  |  1.01%  |  0.92%  |  0.77%  |  0.74%  |  0.55%  |  0.83%  |  0.80%  |  0.61%  |  0.86%  |  0.67%  |  0.55%  |  0.64%  |  0.74%  |  0.80%  |  0.49%  |  0.64%  |  0.67%  |  0.31%  |  0.37%  |  0.34%  |  0.31%  |  0.37%  |  0.28%  |  0.06%  |  0.06%  |  0.09%  |     50  |
 (2006,City of London)  |  2006  |  City of London  |         7254  |       3959  |  0.66%  |  0.63%  |  0.66%  |  0.51%  |  0.45%  |  0.33%  |  0.40%  |  0.58%  |  0.56%  |  0.45%  |  0.76%  |  0.45%  |  0.51%  |  0.43%  |  0.18%  |  0.13%  |  0.13%  |  0.38%  |  0.30%  |  0.00%  |  0.30%  |  0.48%  |  0.81%  |  1.59%  |  1.59%  |  2.07%  |  2.75%  |  2.10%  |  2.50%  |  3.13%  |  2.88%  |  2.60%  |  2.10%  |  2.15%  |  2.93%  |  2.48%  |  1.94%  |  1.87%  |  2.70%  |  2.20%  |  1.89%  |  2.07%  |  1.72%  |  1.59%  |  1.74%  |  1.49%  |  1.57%  |  1.34%  |  2.10%  |  1.67%  |  1.52%  |  1.31%  |  1.21%  |  1.59%  |  1.21%  |  2.15%  |  1.69%  |  1.19%  |  1.72%  |  1.57%  |  1.41%  |  1.41%  |  1.21%  |  1.36%  |  1.01%  |  0.71%  |  0.66%  |  1.04%  |  0.78%  |  0.56%  |  0.58%  |  0.51%  |  0.35%  |  0.40%  |  0.48%  |  0.73%  |  0.43%  |  0.51%  |  0.71%  |  0.43%  |  0.35%  |  0.48%  |  0.15%  |  0.25%  |  0.30%  |  0.13%  |  0.10%  |  0.15%  |  0.30%  |  0.18%  |     13  |         3295  |  0.85%  |  0.79%  |  0.94%  |  0.36%  |  0.52%  |  0.76%  |  0.70%  |  0.61%  |  0.67%  |  0.76%  |  0.42%  |  0.55%  |  0.15%  |  0.58%  |  0.12%  |  0.21%  |  0.12%  |  0.36%  |  0.21%  |  0.82%  |  0.73%  |  1.00%  |  1.55%  |  1.76%  |  2.15%  |  2.67%  |  2.43%  |  2.61%  |  2.61%  |  2.79%  |  2.55%  |  2.61%  |  2.37%  |  2.55%  |  2.43%  |  2.34%  |  2.25%  |  2.06%  |  1.88%  |  1.37%  |  1.61%  |  1.37%  |  1.55%  |  1.37%  |  1.40%  |  1.18%  |  1.15%  |  1.00%  |  1.61%  |  0.94%  |  1.12%  |  1.73%  |  1.18%  |  1.09%  |  1.15%  |  1.09%  |  1.70%  |  1.52%  |  1.61%  |  1.43%  |  0.91%  |  1.24%  |  0.94%  |  1.03%  |  0.73%  |  0.91%  |  0.88%  |  0.70%  |  0.79%  |  0.52%  |  0.82%  |  0.79%  |  0.61%  |  0.79%  |  0.73%  |  0.55%  |  0.61%  |  0.67%  |  0.82%  |  0.52%  |  0.61%  |  0.58%  |  0.33%  |  0.33%  |  0.30%  |  0.27%  |  0.33%  |  0.27%  |  0.06%  |  0.00%  |     45  |
 (2007,City of London)  |  2007  |  City of London  |         7607  |       4197  |  0.74%  |  0.60%  |  0.57%  |  0.52%  |  0.55%  |  0.38%  |  0.31%  |  0.33%  |  0.64%  |  0.55%  |  0.36%  |  0.79%  |  0.38%  |  0.45%  |  0.17%  |  0.17%  |  0.07%  |  0.21%  |  0.38%  |  0.64%  |  0.00%  |  0.71%  |  0.83%  |  1.52%  |  2.17%  |  2.14%  |  2.69%  |  2.93%  |  2.36%  |  2.55%  |  2.93%  |  2.43%  |  2.53%  |  2.00%  |  2.07%  |  2.72%  |  2.48%  |  2.05%  |  1.98%  |  2.79%  |  2.10%  |  1.88%  |  1.76%  |  1.67%  |  1.79%  |  1.76%  |  1.50%  |  1.52%  |  1.36%  |  1.91%  |  1.55%  |  1.48%  |  1.31%  |  1.22%  |  1.52%  |  1.26%  |  1.86%  |  1.52%  |  1.14%  |  1.50%  |  1.41%  |  1.29%  |  1.38%  |  1.10%  |  1.29%  |  0.86%  |  0.62%  |  0.71%  |  0.93%  |  0.71%  |  0.52%  |  0.55%  |  0.41%  |  0.38%  |  0.38%  |  0.45%  |  0.64%  |  0.36%  |  0.36%  |  0.69%  |  0.33%  |  0.33%  |  0.43%  |  0.14%  |  0.14%  |  0.24%  |  0.10%  |  0.10%  |  0.14%  |  0.21%  |     20  |         3410  |  0.70%  |  0.70%  |  0.88%  |  0.73%  |  0.50%  |  0.50%  |  0.50%  |  0.62%  |  0.47%  |  0.62%  |  0.73%  |  0.44%  |  0.53%  |  0.12%  |  0.56%  |  0.09%  |  0.32%  |  0.70%  |  0.44%  |  0.70%  |  1.14%  |  1.00%  |  1.64%  |  2.05%  |  2.20%  |  2.67%  |  2.93%  |  2.49%  |  2.96%  |  2.43%  |  2.35%  |  2.23%  |  2.35%  |  2.11%  |  2.11%  |  2.11%  |  2.23%  |  2.14%  |  1.82%  |  1.91%  |  1.38%  |  1.64%  |  1.41%  |  1.61%  |  1.47%  |  1.44%  |  1.26%  |  1.06%  |  0.88%  |  1.41%  |  0.85%  |  1.11%  |  1.58%  |  1.20%  |  1.14%  |  1.14%  |  1.14%  |  1.64%  |  1.52%  |  1.55%  |  1.35%  |  0.79%  |  1.20%  |  1.03%  |  0.94%  |  0.79%  |  0.88%  |  0.94%  |  0.65%  |  0.70%  |  0.47%  |  0.79%  |  0.76%  |  0.53%  |  0.73%  |  0.67%  |  0.50%  |  0.53%  |  0.65%  |  0.67%  |  0.50%  |  0.50%  |  0.56%  |  0.32%  |  0.29%  |  0.29%  |  0.21%  |  0.26%  |  0.23%  |  0.03%  |     36  |
 (2008,City of London)  |  2008  |  City of London  |         7429  |       4131  |  0.70%  |  0.63%  |  0.53%  |  0.58%  |  0.44%  |  0.53%  |  0.31%  |  0.29%  |  0.41%  |  0.73%  |  0.48%  |  0.36%  |  0.73%  |  0.41%  |  0.24%  |  0.19%  |  0.15%  |  0.17%  |  0.27%  |  0.44%  |  0.68%  |  0.27%  |  1.04%  |  0.94%  |  1.82%  |  2.42%  |  2.06%  |  2.98%  |  2.95%  |  2.47%  |  2.25%  |  2.69%  |  2.32%  |  2.44%  |  1.82%  |  1.94%  |  2.49%  |  2.23%  |  2.01%  |  1.91%  |  2.93%  |  2.08%  |  1.91%  |  1.67%  |  1.69%  |  1.60%  |  1.86%  |  1.38%  |  1.62%  |  1.62%  |  1.96%  |  1.55%  |  1.48%  |  1.23%  |  1.26%  |  1.48%  |  1.33%  |  1.77%  |  1.48%  |  1.11%  |  1.45%  |  1.48%  |  1.28%  |  1.33%  |  1.02%  |  1.28%  |  0.82%  |  0.63%  |  0.70%  |  0.94%  |  0.70%  |  0.58%  |  0.53%  |  0.41%  |  0.36%  |  0.34%  |  0.46%  |  0.58%  |  0.34%  |  0.39%  |  0.65%  |  0.31%  |  0.29%  |  0.41%  |  0.15%  |  0.15%  |  0.17%  |  0.10%  |  0.07%  |  0.12%  |     25  |         3298  |  0.36%  |  0.52%  |  0.70%  |  0.70%  |  0.73%  |  0.49%  |  0.52%  |  0.49%  |  0.58%  |  0.45%  |  0.64%  |  0.73%  |  0.45%  |  0.58%  |  0.03%  |  0.58%  |  0.00%  |  0.67%  |  0.79%  |  0.76%  |  1.06%  |  1.30%  |  1.06%  |  1.73%  |  2.21%  |  2.49%  |  2.70%  |  2.88%  |  2.67%  |  2.85%  |  2.30%  |  2.33%  |  2.06%  |  2.09%  |  1.73%  |  1.82%  |  1.85%  |  1.94%  |  2.06%  |  1.73%  |  1.91%  |  1.24%  |  1.58%  |  1.39%  |  1.58%  |  1.52%  |  1.52%  |  1.12%  |  1.06%  |  0.97%  |  1.27%  |  0.88%  |  1.15%  |  1.61%  |  1.21%  |  1.27%  |  1.27%  |  1.15%  |  1.58%  |  1.55%  |  1.55%  |  1.46%  |  0.82%  |  1.24%  |  1.03%  |  0.88%  |  0.91%  |  0.94%  |  0.88%  |  0.70%  |  0.67%  |  0.49%  |  0.85%  |  0.82%  |  0.61%  |  0.73%  |  0.67%  |  0.49%  |  0.45%  |  0.67%  |  0.73%  |  0.45%  |  0.52%  |  0.55%  |  0.30%  |  0.27%  |  0.27%  |  0.21%  |  0.27%  |  0.24%  |     30  |

Calling parallel() as per the example below enables concurrent iteration over the DataFrame rows which internally is implemented using the Fork and Join framework introduced in Java 7. This is the exact same procedure as above, but would likely be significantly faster for a very large frame on a multi-core machine. It has to be said that parallel execution will not necessarily always be faster due to the overhead of context switching, however if the consumer function being executed is expensive or the frame is very large, you will likely see a significant performance boost.

//Parallel: Convert male & female population counts into weights
frame.rows().parallel().forEach(row -> row.forEach(value -> {
    if (value.colKey().matches("M\\s+\\d+")) {
        double totalMales = value.row().getDouble("All Males");
        double count = value.getDouble();
        value.setDouble(count / totalMales);
    } else if (value.colKey().matches("F\\s+\\d+")) {
        double totalFemales = value.row().getDouble("All Females");
        double count = value.getDouble();
        value.setDouble(count / totalFemales);
    }
}));

Value Access

Random Access

Forgetting about the ONS example for a moment, let's construct a new 5x5 DataFrame programmatically with mixed types as per the code below. The first 4 columns are of a homogeneous type, while the fifth column contains a mixture of types.

import java.time.LocalDate;
import java.time.Month;
import java.time.Year;

import com.zavtech.morpheus.util.Range;
import com.zavtech.morpheus.array.Array;
import com.zavtech.morpheus.frame.DataFrame;

//Create 5x5 frame with columns of different types.
final Range<Year> years = Range.of(2000 ,2005).map(Year::of);
final DataFrame<Year,String> frame = DataFrame.of(years, String.class, columns -> {
    columns.add("Column-0", Array.of(true, false, false, true, true));
    columns.add("Column-1", Array.of(1, 2, 3, 4, 5));
    columns.add("Column-2", Array.of(10L, 11L, 12L, 13L, 14L));
    columns.add("Column-3", Array.of(20d, 21d, 22d, 23d, 24d));
    columns.add("Column-4", Array.of("Hello", LocalDate.of(1998, 1, 1), Month.JANUARY, 56.45d, true));
});
 Index  |  Column-0  |  Column-1  |  Column-2  |  Column-3  |   Column-4   |
----------------------------------------------------------------------------
  2000  |      true  |         1  |        10  |   20.0000  |       Hello  |
  2001  |     false  |         2  |        11  |   21.0000  |  1998-01-01  |
  2002  |     false  |         3  |        12  |   22.0000  |     JANUARY  |
  2003  |      true  |         4  |        13  |   23.0000  |      56.450  |
  2004  |      true  |         5  |        14  |   24.0000  |        true  |

Random access to DataFrame values is possible via the function calls illustrated below. There are type specific access methods for primitives, specifically with support for boolean, int, longand double. Type agnostic methods are also available, namely getValue() and setValue(), however when accessing primitive values in this manner, boxing will take place with a small but inevitable performance hit. The random access API allows values to be accessed by ordinals, keys or a combination of ordinals and keys for ultimate flexibility.

Type specific random access methods on this frame using a combination of ordinals and keys are shown below. Note that there are corresponding setter methods analogous to these getters, but are omitted for brevity. If a type incompatible call is made, for example calling getBoolean() on a cell that contains a double, a DataFrameException will be thrown.

//Random access to primitive boolean values via ordinal or keys or any combination thereof
boolean b1 = frame.data().getBoolean(0, 0);
boolean b2 = frame.data().getBoolean(Year.of(2003), 0);
boolean b3 = frame.data().getBoolean(0, "Column-0");
boolean b4 = frame.data().getBoolean(Year.of(2001), "Column-0");

//Random access to primitive int values via ordinal or keys or any combination thereof
int i1 = frame.data().getInt(4, 1);
int i2 = frame.data().getInt(Year.of(2003), 1);
int i3 = frame.data().getInt(0, "Column-1");
int i4 = frame.data().getInt(Year.of(2001), "Column-1");

//Random access to primitive long values via ordinal or keys or any combination thereof
long l1 = frame.data().getLong(4, 2);
long l2 = frame.data().getLong(Year.of(2003), 2);
long l3 = frame.data().getLong(0, "Column-2");
long l4 = frame.data().getLong(Year.of(2001), "Column-2");

//Random access to primitive double values via ordinal or keys or any combination thereof
double d1 = frame.data().getDouble(4, 3);
double d2 = frame.data().getDouble(Year.of(2003), 3);
double d3 = frame.data().getDouble(0, "Column-3");
double d4 = frame.data().getDouble(Year.of(2001), "Column-3");

//Random access to any values via ordinal or keys or any combination thereof
String o1 = frame.data().getValue(0, 4);
LocalDate o2 = frame.data().getValue(Year.of(2001), 4);
Month o3 = frame.data().getValue(2, "Column-4");
Double o4 = frame.data().getValue(Year.of(2004), "Column-4");

Iteration

To iterate over all values in a DataFrame, use the forEachValue() method or the values() method to access a Java 8 stream of DataFrameValue objects. The API makes it easy to iterate over all values in parallel much the same way as the java.util.stream.Stream interface, simply by calling parallel() on the frame. The example below first creates a 8x4 frame of doubles initialized with random values between 0 and 1, and then counts the number of values > 0.5, first sequentially, then in parallel.

//Create DataFrame of random doubles
DataFrame<Integer,String> frame = DataFrame.ofDoubles(
    Array.of(0, 1, 2, 3, 4, 5, 6, 7),
    Array.of("A", "B", "C", "D"), 
    value -> Math.random()
);

//Count number of values > 0.5d first sequentially, then in parallel
long count1 = frame.values().filter(v -> v.getDouble() > 0.5d).count();
long count2 = frame.values().parallel().filter(v -> v.getDouble() > 0.5d).count();
Assert.assertEquals(count1, count2);

It should be noted that using the parallel API will not always speed up execution, and in some cases will actually result in worse performance. If one or more of the stream pipeline operations (such as filter()) is slow, then parallel execution should significantly improve performance over sequential execution.

DataFrameValue

The forEachValue() and the values() method operate on a class called DataFrameValue, which provides a versatile API that wraps the actual datum value. For example, it provides an isNull() method to indicate if a value is null, which avoids the consumer from having to code type specific checks, such as for Double.isNaN. The DataFrameValue also provides access to the row and column ordinals and keys associated with the datum, via rowOrdinal(), colOrdinal(), rowKey() and colKey() methods, in addition to the frame itself via frame(). This makes it possible to write more reusable consumers and predicates for example.

First & Last

Selecting the first and last row or column returns an Optional<DataFrameRow> and Optional<DataFrameColumn> respectively, as shown in the following examples:

//Load the Wimbledon dataset
DataFrame<Integer,String> frame = getWimbledonData(2013);

//Select the first row, and assert match date is 24-06-2013
frame.rows().first().ifPresent(row -> {
    LocalDate matchDate = row.getValue("Date");
    assert(matchDate.equals(LocalDate.of(2013, 6, 24)));
});

//Select last row, and assert the winner is A Murray.
frame.rows().last().ifPresent(row -> {
    String winner = row.getValue("Winner");
    assert(winner.equals("Murray A."));
});

//Select first column, namely the date column, and find max date
frame.cols().first().ifPresent(column -> {
    Optional<LocalDate> matchDate = column.max();
    LocalDate finalDate = LocalDate.of(2013, 7, 7);
    assert(matchDate.isPresent() && matchDate.get().equals(finalDate));
});

//Select last column and find the max AvgL betting odds
frame.cols().last().ifPresent(column -> {
    double matchDate = column.stats().max();
    assert(matchDate == 23.26d);
});

Examples

Demean

Let's say we wish to demean the male and female population counts in the ONS DataFrame introduced earlier. That is to say, for each row, we want to compute the average male and female population value, and them subtract the male average from all male counts, and subtract the female average from all female counts.

//Demean male and female population counts
final DataFrame<Tuple,String> onsFrame = loadPopulationDataset();

//Iterate over male then female column set
Array.of("M\\s+\\d++", "F\\s+\\d++").forEach(regex -> {
    onsFrame.cols().select(c -> c.key().matches(regex)).rows().parallel().forEach(row -> {
        final double mean = row.stats().mean();
        row.applyDoubles(v -> v.getDouble() - mean);
    });
});

//Print frame to std out with custom formatting
frame.out().print(formats -> {
    formats.withDecimalFormat("All Persons", "0;-0", 1);
    formats.withDecimalFormat("All Males", "0;-0", 1);
    formats.withDecimalFormat("All Females", "0;-0", 1);
    formats.withDecimalFormat(Double.class, "0.00;-0.00", 1);
});
         Index          |  Year  |     Borough      |  All Persons  |  All Males  |   M 0    |   M 1    |   M 2    |   M 3    |   M 4    |   M 5    |   M 6    |   M 7    |   M 8    |   M 9    |   M 10   |   M 11   |   M 12   |   M 13   |   M 14   |   M 15   |   M 16   |   M 17   |   M 18   |   M 19   |   M 20   |   M 21   |   M 22   |  M 23   |  M 24   |  M 25   |  M 26   |  M 27   |  M 28   |  M 29   |  M 30   |  M 31   |  M 32   |  M 33   |  M 34   |  M 35   |  M 36   |  M 37   |  M 38   |  M 39   |  M 40   |  M 41   |  M 42   |  M 43   |  M 44   |  M 45   |  M 46   |  M 47   |  M 48   |  M 49   |  M 50   |  M 51   |  M 52   |  M 53   |  M 54   |  M 55   |  M 56   |  M 57   |  M 58   |  M 59   |   M 60   |   M 61   |   M 62   |   M 63   |   M 64   |   M 65   |   M 66   |   M 67   |   M 68   |   M 69   |   M 70   |   M 71   |   M 72   |   M 73   |   M 74   |   M 75   |   M 76   |   M 77   |   M 78   |   M 79   |   M 80   |   M 81   |   M 82   |   M 83   |   M 84   |   M 85   |   M 86   |   M 87   |   M 88   |   M 89   |  M 90+  |  All Females  |   F 0    |   F 1    |   F 2    |   F 3    |   F 4    |   F 5    |   F 6    |   F 7    |   F 8    |   F 9    |   F 10   |   F 11   |   F 12   |   F 13   |   F 14   |   F 15   |   F 16   |   F 17   |   F 18   |   F 19   |   F 20   |  F 21   |  F 22   |  F 23   |  F 24   |  F 25   |  F 26   |  F 27   |  F 28   |  F 29   |  F 30   |  F 31   |  F 32   |  F 33   |  F 34   |  F 35   |  F 36   |  F 37   |  F 38   |  F 39   |  F 40   |  F 41   |  F 42   |  F 43   |  F 44   |  F 45   |  F 46   |  F 47   |  F 48   |  F 49   |  F 50   |  F 51   |  F 52   |  F 53   |  F 54   |  F 55   |  F 56   |  F 57   |  F 58   |  F 59   |  F 60   |   F 61   |   F 62   |   F 63   |   F 64   |   F 65   |   F 66   |   F 67   |   F 68   |   F 69   |   F 70   |   F 71   |   F 72   |   F 73   |   F 74   |   F 75   |   F 76   |   F 77   |   F 78   |   F 79   |   F 80   |   F 81   |   F 82   |   F 83   |   F 84   |   F 85   |   F 86   |   F 87   |   F 88   |   F 89   |  F 90+  |
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 (1999,City of London)  |  1999  |  City of London  |         6581  |       3519  |  -16.92  |  -17.92  |  -18.92  |  -19.92  |  -20.92  |  -19.92  |  -20.92  |  -19.92  |  -20.92  |  -18.92  |  -18.92  |  -19.92  |  -21.92  |  -22.92  |  -23.92  |  -23.92  |  -23.92  |  -19.92  |  -14.92  |   -8.92  |   -0.92  |    6.08  |   11.08  |  19.08  |  24.08  |  29.08  |  32.08  |  32.08  |  32.08  |  37.08  |  37.08  |  36.08  |  34.08  |  31.08  |  30.08  |  30.08  |  24.08  |  19.08  |  17.08  |  17.08  |  16.08  |  14.08  |  10.08  |  12.08  |  12.08  |  18.08  |  18.08  |  19.08  |  24.08  |  27.08  |  27.08  |  29.08  |  22.08  |  21.08  |  20.08  |  13.08  |   8.08  |   6.08  |   2.08  |  -2.92  |   -5.92  |   -6.92  |   -6.92  |   -7.92  |   -8.92  |   -9.92  |   -8.92  |   -9.92  |  -10.92  |  -10.92  |  -11.92  |  -13.92  |  -14.92  |  -16.92  |  -17.92  |  -20.92  |  -20.92  |  -22.92  |  -23.92  |  -25.92  |  -26.92  |  -28.92  |  -28.92  |  -29.92  |  -29.92  |    2.08  |     NaN  |     NaN  |     NaN  |     NaN  |      0  |         3062  |  -11.60  |  -11.60  |  -13.60  |  -13.60  |  -14.60  |  -14.60  |  -16.60  |  -16.60  |  -17.60  |  -17.60  |  -17.60  |  -19.60  |  -18.60  |  -19.60  |  -19.60  |  -19.60  |  -15.60  |  -10.60  |   -9.60  |   -5.60  |    3.40  |  11.40  |  14.40  |  18.40  |  25.40  |  32.40  |  35.40  |  36.40  |  35.40  |  37.40  |  35.40  |  32.40  |  30.40  |  26.40  |  19.40  |  15.40  |  11.40  |   7.40  |   6.40  |   3.40  |   3.40  |   5.40  |   6.40  |   7.40  |   8.40  |   4.40  |   8.40  |   9.40  |  11.40  |  12.40  |  13.40  |  13.40  |  14.40  |  10.40  |   8.40  |   3.40  |   0.40  |  -1.60  |  -2.60  |  -4.60  |  -5.60  |   -6.60  |   -6.60  |   -5.60  |   -4.60  |   -5.60  |   -5.60  |   -6.60  |   -6.60  |   -7.60  |   -9.60  |   -9.60  |  -10.60  |  -12.60  |  -14.60  |  -15.60  |  -15.60  |  -16.60  |  -18.60  |  -18.60  |  -18.60  |  -19.60  |  -20.60  |  -21.60  |  -22.60  |   40.40  |     NaN  |     NaN  |     NaN  |     NaN  |      0  |
 (2000,City of London)  |  2000  |  City of London  |         7014  |       3775  |  -18.90  |  -18.90  |  -19.90  |  -20.90  |  -21.90  |  -22.90  |  -21.90  |  -22.90  |  -21.90  |  -22.90  |  -21.90  |  -23.90  |  -25.90  |  -27.90  |  -27.90  |  -28.90  |  -26.90  |  -24.90  |  -19.90  |  -13.90  |   -4.90  |    4.10  |   13.10  |  20.10  |  28.10  |  37.10  |  44.10  |  46.10  |  46.10  |  47.10  |  50.10  |  50.10  |  46.10  |  42.10  |  37.10  |  36.10  |  32.10  |  26.10  |  21.10  |  18.10  |  18.10  |  18.10  |  15.10  |  12.10  |  12.10  |  12.10  |  18.10  |  18.10  |  18.10  |  23.10  |  27.10  |  27.10  |  30.10  |  22.10  |  20.10  |  19.10  |  12.10  |   6.10  |   3.10  |  -0.90  |   -4.90  |   -9.90  |  -11.90  |  -12.90  |  -13.90  |  -14.90  |  -15.90  |  -15.90  |  -16.90  |  -15.90  |  -16.90  |  -17.90  |  -18.90  |  -20.90  |  -21.90  |  -21.90  |  -24.90  |  -24.90  |  -26.90  |  -27.90  |  -28.90  |  -29.90  |  -31.90  |  -31.90  |  -32.90  |   -4.90  |     NaN  |     NaN  |     NaN  |     NaN  |      0  |         3239  |  -11.66  |  -13.66  |  -13.66  |  -15.66  |  -16.66  |  -16.66  |  -17.66  |  -18.66  |  -18.66  |  -18.66  |  -18.66  |  -19.66  |  -20.66  |  -19.66  |  -20.66  |  -19.66  |  -17.66  |  -14.66  |   -9.66  |   -5.66  |    0.34  |  11.34  |  20.34  |  23.34  |  31.34  |  37.34  |  44.34  |  45.34  |  46.34  |  43.34  |  42.34  |  38.34  |  35.34  |  31.34  |  26.34  |  19.34  |  15.34  |  10.34  |   6.34  |   5.34  |   3.34  |   4.34  |   3.34  |   5.34  |   5.34  |   6.34  |   3.34  |   7.34  |   7.34  |   9.34  |  11.34  |  12.34  |  13.34  |  13.34  |   9.34  |   7.34  |   3.34  |  -0.66  |  -2.66  |  -5.66  |  -7.66  |   -8.66  |   -9.66  |  -10.66  |   -9.66  |   -8.66  |   -9.66  |   -9.66  |   -9.66  |   -9.66  |  -10.66  |  -12.66  |  -12.66  |  -13.66  |  -15.66  |  -16.66  |  -18.66  |  -17.66  |  -18.66  |  -20.66  |  -21.66  |  -22.66  |  -22.66  |  -22.66  |  -24.66  |   43.34  |     NaN  |     NaN  |     NaN  |     NaN  |      0  |
 (2001,City of London)  |  2001  |  City of London  |         7359  |       3984  |  -27.12  |  -14.12  |  -19.12  |  -25.12  |  -23.12  |  -19.12  |  -24.12  |  -28.12  |  -25.12  |  -17.12  |  -18.12  |  -28.12  |  -15.12  |  -25.12  |  -33.12  |  -30.12  |  -32.12  |  -31.12  |  -32.12  |  -17.12  |   -6.12  |   -5.12  |    8.88  |  18.88  |  35.88  |  65.88  |  65.88  |  55.88  |  63.88  |  80.88  |  69.88  |  50.88  |  48.88  |  60.88  |  54.88  |  39.88  |  44.88  |  26.88  |  18.88  |  30.88  |  20.88  |   7.88  |   2.88  |  31.88  |  28.88  |   9.88  |   4.88  |   0.88  |  15.88  |   4.88  |  66.88  |  28.88  |  10.88  |  36.88  |  35.88  |  16.88  |  18.88  |  11.88  |  19.88  |   3.88  |  -16.12  |  -10.12  |    0.88  |   -8.12  |  -19.12  |  -16.12  |  -23.12  |  -16.12  |  -23.12  |  -17.12  |  -17.12  |  -23.12  |  -20.12  |  -15.12  |  -23.12  |  -25.12  |  -21.12  |  -24.12  |  -33.12  |  -25.12  |  -29.12  |  -30.12  |  -36.12  |  -29.12  |  -34.12  |  -38.12  |  -34.12  |  -39.12  |  -40.12  |  -41.12  |     13  |         3375  |   -5.33  |   -7.33  |  -14.33  |  -16.33  |  -11.33  |  -21.33  |  -16.33  |  -22.33  |  -19.33  |  -13.33  |  -17.33  |  -17.33  |  -27.33  |  -11.33  |  -24.33  |  -24.33  |  -23.33  |    1.67  |   -9.33  |   -2.33  |    9.67  |   1.67  |  11.67  |  16.67  |  36.67  |  55.67  |  51.67  |  42.67  |  46.67  |  69.67  |  47.67  |  45.67  |  63.67  |  28.67  |  22.67  |  16.67  |  28.67  |  22.67  |  10.67  |   7.67  |  -0.33  |  -9.33  |  -6.33  |  25.67  |   5.67  |  15.67  |  12.67  |   9.67  |  -2.33  |   4.67  |  -0.33  |  27.67  |  10.67  |  19.67  |  19.67  |   0.67  |   7.67  |   0.67  |   0.67  |  -4.33  |  -5.33  |   -5.33  |  -11.33  |  -12.33  |  -13.33  |   -8.33  |   -9.33  |  -10.33  |   -3.33  |  -10.33  |  -17.33  |  -11.33  |  -13.33  |   -6.33  |  -19.33  |  -13.33  |  -10.33  |  -24.33  |  -24.33  |  -22.33  |  -19.33  |  -15.33  |  -19.33  |  -26.33  |  -27.33  |  -27.33  |  -23.33  |  -11.33  |  -21.33  |  -30.33  |     15  |
 (2002,City of London)  |  2002  |  City of London  |         7280  |       3968  |  -14.93  |  -25.93  |  -15.93  |  -16.93  |  -23.93  |  -23.93  |  -19.93  |  -23.93  |  -26.93  |  -23.93  |  -18.93  |  -18.93  |  -29.93  |  -16.93  |  -34.93  |  -38.93  |  -35.93  |  -33.93  |  -31.93  |  -33.93  |  -23.93  |   -4.93  |    6.07  |  17.07  |  24.07  |  55.07  |  69.07  |  78.07  |  58.07  |  70.07  |  70.07  |  63.07  |  55.07  |  45.07  |  57.07  |  49.07  |  40.07  |  33.07  |  29.07  |  17.07  |  34.07  |  21.07  |  13.07  |   6.07  |  31.07  |  28.07  |  12.07  |   6.07  |   1.07  |  17.07  |   2.07  |  69.07  |  26.07  |   5.07  |  41.07  |  32.07  |  15.07  |  17.07  |  11.07  |  16.07  |    1.07  |  -15.93  |  -12.93  |    2.07  |   -3.93  |  -20.93  |  -17.93  |  -23.93  |  -18.93  |  -22.93  |  -19.93  |  -13.93  |  -22.93  |  -18.93  |  -14.93  |  -23.93  |  -25.93  |  -22.93  |  -26.93  |  -32.93  |  -26.93  |  -29.93  |  -30.93  |  -35.93  |  -28.93  |  -34.93  |  -37.93  |  -35.93  |  -39.93  |  -41.93  |     14  |         3312  |   -8.58  |   -1.58  |   -6.58  |  -17.58  |  -15.58  |  -10.58  |  -21.58  |  -16.58  |  -23.58  |  -18.58  |  -19.58  |  -21.58  |  -19.58  |  -30.58  |  -17.58  |  -23.58  |  -31.58  |  -21.58  |   -1.58  |   -7.58  |   -1.58  |  11.42  |  15.42  |  10.42  |  30.42  |  37.42  |  47.42  |  47.42  |  46.42  |  33.42  |  78.42  |  47.42  |  57.42  |  64.42  |  26.42  |  24.42  |  20.42  |  21.42  |  25.42  |   7.42  |  10.42  |   0.42  |  -8.58  |  -3.58  |  23.42  |  -0.58  |  10.42  |  15.42  |   8.42  |  -0.58  |   1.42  |   4.42  |  26.42  |  14.42  |  17.42  |  18.42  |   0.42  |   4.42  |   3.42  |  -0.58  |  -6.58  |   -7.58  |   -6.58  |   -9.58  |  -13.58  |  -13.58  |   -8.58  |   -8.58  |  -11.58  |   -2.58  |  -11.58  |  -17.58  |  -12.58  |  -13.58  |   -5.58  |  -17.58  |  -11.58  |  -10.58  |  -26.58  |  -24.58  |  -22.58  |  -19.58  |  -14.58  |  -21.58  |  -27.58  |  -26.58  |  -29.58  |  -25.58  |  -10.58  |  -22.58  |     20  |
 (2003,City of London)  |  2003  |  City of London  |         7115  |       3892  |   -8.10  |  -19.10  |  -27.10  |  -21.10  |  -17.10  |  -26.10  |  -24.10  |  -19.10  |  -22.10  |  -22.10  |  -19.10  |  -18.10  |  -22.10  |  -33.10  |  -27.10  |  -33.10  |  -39.10  |  -38.10  |  -31.10  |  -31.10  |  -32.10  |  -24.10  |    5.90  |  16.90  |  22.90  |  36.90  |  56.90  |  74.90  |  70.90  |  61.90  |  64.90  |  61.90  |  55.90  |  50.90  |  41.90  |  53.90  |  45.90  |  38.90  |  32.90  |  25.90  |  19.90  |  30.90  |  20.90  |  13.90  |   7.90  |  31.90  |  30.90  |  12.90  |   7.90  |  -4.10  |  20.90  |   0.90  |  64.90  |  21.90  |   3.90  |  36.90  |  30.90  |  12.90  |  17.90  |  11.90  |   11.90  |    0.90  |  -17.10  |  -13.10  |   -1.10  |   -7.10  |  -20.10  |  -19.10  |  -21.10  |  -21.10  |  -25.10  |  -20.10  |  -12.10  |  -25.10  |  -19.10  |  -16.10  |  -24.10  |  -26.10  |  -21.10  |  -28.10  |  -33.10  |  -27.10  |  -31.10  |  -33.10  |  -35.10  |  -29.10  |  -35.10  |  -37.10  |  -36.10  |  -41.10  |     13  |         3223  |  -17.52  |  -10.52  |   -4.52  |   -6.52  |  -17.52  |  -14.52  |   -9.52  |  -21.52  |  -16.52  |  -23.52  |  -16.52  |  -22.52  |  -24.52  |  -23.52  |  -33.52  |  -19.52  |  -28.52  |  -23.52  |  -13.52  |   -4.52  |   -1.52  |   1.48  |  16.48  |  25.48  |  22.48  |  49.48  |  37.48  |  50.48  |  46.48  |  49.48  |  39.48  |  63.48  |  49.48  |  53.48  |  56.48  |  24.48  |  22.48  |   9.48  |  15.48  |  17.48  |   6.48  |  11.48  |   8.48  |  -6.52  |  -0.52  |  23.48  |   2.48  |   5.48  |  13.48  |   3.48  |  -0.52  |   4.48  |   1.48  |  25.48  |  13.48  |  17.48  |  14.48  |  -0.52  |   4.48  |  -1.52  |   0.48  |   -5.52  |   -6.52  |   -5.52  |   -8.52  |  -11.52  |  -12.52  |   -7.52  |   -5.52  |  -10.52  |   -3.52  |  -11.52  |  -18.52  |  -12.52  |  -14.52  |   -5.52  |  -19.52  |  -12.52  |  -11.52  |  -25.52  |  -24.52  |  -21.52  |  -20.52  |  -19.52  |  -19.52  |  -26.52  |  -33.52  |  -30.52  |  -25.52  |  -13.52  |     26  |
 (2004,City of London)  |  2004  |  City of London  |         7118  |       3875  |  -14.92  |  -15.92  |  -17.92  |  -26.92  |  -22.92  |  -15.92  |  -25.92  |  -22.92  |  -11.92  |  -24.92  |  -20.92  |  -21.92  |  -20.92  |  -26.92  |  -38.92  |  -29.92  |  -34.92  |  -42.92  |  -40.92  |  -29.92  |  -33.92  |  -17.92  |  -16.92  |  20.08  |  27.08  |  26.08  |  46.08  |  69.08  |  72.08  |  73.08  |  57.08  |  50.08  |  59.08  |  50.08  |  43.08  |  36.08  |  56.08  |  49.08  |  45.08  |  38.08  |  30.08  |  16.08  |  22.08  |  24.08  |  15.08  |   6.08  |  33.08  |  27.08  |  12.08  |   7.08  |   1.08  |  18.08  |   2.08  |  56.08  |  22.08  |   3.08  |  34.08  |  33.08  |  12.08  |  14.08  |   10.08  |   14.08  |    0.08  |  -14.92  |  -10.92  |   -3.92  |   -8.92  |  -20.92  |  -17.92  |  -21.92  |  -20.92  |  -24.92  |  -22.92  |  -12.92  |  -26.92  |  -18.92  |  -14.92  |  -23.92  |  -28.92  |  -22.92  |  -33.92  |  -30.92  |  -28.92  |  -32.92  |  -34.92  |  -34.92  |  -27.92  |  -34.92  |  -37.92  |  -37.92  |     12  |         3243  |   -4.57  |  -17.57  |  -15.57  |   -9.57  |  -10.57  |  -15.57  |  -10.57  |   -7.57  |  -21.57  |  -16.57  |  -28.57  |  -16.57  |  -25.57  |  -26.57  |  -26.57  |  -34.57  |  -22.57  |  -18.57  |  -26.57  |  -13.57  |    2.43  |   5.43  |  11.43  |  23.43  |  43.43  |  44.43  |  55.43  |  50.43  |  43.43  |  45.43  |  43.43  |  42.43  |  55.43  |  44.43  |  51.43  |  47.43  |  20.43  |  25.43  |  11.43  |  12.43  |  19.43  |   4.43  |   9.43  |   3.43  |  -5.57  |  -1.57  |  23.43  |   1.43  |   3.43  |  20.43  |   2.43  |  -2.57  |   2.43  |   0.43  |  24.43  |  15.43  |  16.43  |  15.43  |  -1.57  |   4.43  |  -0.57  |   -1.57  |   -7.57  |   -3.57  |   -7.57  |   -8.57  |  -10.57  |  -15.57  |   -6.57  |   -7.57  |  -11.57  |   -5.57  |  -11.57  |  -20.57  |  -14.57  |  -13.57  |   -6.57  |  -20.57  |  -12.57  |  -13.57  |  -23.57  |  -24.57  |  -23.57  |  -24.57  |  -23.57  |  -23.57  |  -28.57  |  -34.57  |  -32.57  |  -26.57  |     42  |
 (2005,City of London)  |  2005  |  City of London  |         7131  |       3869  |   -8.86  |  -17.86  |  -20.86  |  -19.86  |  -30.86  |  -23.86  |  -20.86  |  -23.86  |  -23.86  |  -11.86  |  -22.86  |  -21.86  |  -22.86  |  -23.86  |  -38.86  |  -39.86  |  -30.86  |  -32.86  |  -42.86  |  -35.86  |  -33.86  |  -26.86  |    0.14  |  -2.86  |  29.14  |  50.14  |  31.14  |  46.14  |  74.14  |  70.14  |  61.14  |  45.14  |  49.14  |  66.14  |  55.14  |  34.14  |  33.14  |  60.14  |  46.14  |  35.14  |  37.14  |  25.14  |  18.14  |  26.14  |  19.14  |  15.14  |   8.14  |  39.14  |  24.14  |  15.14  |   9.14  |  -0.86  |  16.14  |   7.14  |  46.14  |  24.14  |   4.14  |  30.14  |  27.14  |  12.14  |   15.14  |    7.14  |   10.14  |   -0.86  |  -15.86  |  -12.86  |   -0.86  |  -11.86  |  -19.86  |  -18.86  |  -22.86  |  -25.86  |  -25.86  |  -23.86  |  -12.86  |  -27.86  |  -21.86  |  -15.86  |  -25.86  |  -28.86  |  -21.86  |  -34.86  |  -28.86  |  -30.86  |  -35.86  |  -35.86  |  -36.86  |  -28.86  |  -35.86  |  -40.86  |     12  |         3262  |   -6.69  |   -6.69  |  -20.69  |  -20.69  |  -12.69  |  -10.69  |  -18.69  |  -12.69  |  -10.69  |  -21.69  |  -17.69  |  -28.69  |  -15.69  |  -28.69  |  -28.69  |  -29.69  |  -33.69  |  -28.69  |  -16.69  |  -20.69  |   -4.69  |   7.31  |  13.31  |  14.31  |  46.31  |  40.31  |  53.31  |  53.31  |  49.31  |  40.31  |  54.31  |  40.31  |  49.31  |  55.31  |  38.31  |  44.31  |  38.31  |  24.31  |  19.31  |  16.31  |   9.31  |  16.31  |   7.31  |  11.31  |   2.31  |  -1.69  |  -1.69  |  19.31  |  -2.69  |   2.31  |  21.31  |   2.31  |   0.31  |   3.31  |   1.31  |  22.31  |  16.31  |  19.31  |  14.31  |  -1.69  |   1.31  |   -0.69  |    1.31  |   -9.69  |   -2.69  |   -5.69  |  -10.69  |  -11.69  |  -17.69  |   -8.69  |   -9.69  |  -15.69  |   -7.69  |  -13.69  |  -17.69  |  -14.69  |  -11.69  |   -9.69  |  -19.69  |  -14.69  |  -13.69  |  -25.69  |  -23.69  |  -24.69  |  -25.69  |  -23.69  |  -26.69  |  -33.69  |  -33.69  |  -32.69  |     50  |
 (2006,City of London)  |  2006  |  City of London  |         7254  |       3959  |  -17.84  |  -18.84  |  -17.84  |  -23.84  |  -25.84  |  -30.84  |  -27.84  |  -20.84  |  -21.84  |  -25.84  |  -13.84  |  -25.84  |  -23.84  |  -26.84  |  -36.84  |  -38.84  |  -38.84  |  -28.84  |  -31.84  |  -43.84  |  -31.84  |  -24.84  |  -11.84  |  19.16  |  19.16  |  38.16  |  65.16  |  39.16  |  55.16  |  80.16  |  70.16  |  59.16  |  39.16  |  41.16  |  72.16  |  54.16  |  33.16  |  30.16  |  63.16  |  43.16  |  31.16  |  38.16  |  24.16  |  19.16  |  25.16  |  15.16  |  18.16  |   9.16  |  39.16  |  22.16  |  16.16  |   8.16  |   4.16  |  19.16  |   4.16  |  41.16  |  23.16  |   3.16  |  24.16  |  18.16  |   12.16  |   12.16  |    4.16  |   10.16  |   -3.84  |  -15.84  |  -17.84  |   -2.84  |  -12.84  |  -21.84  |  -20.84  |  -23.84  |  -29.84  |  -27.84  |  -24.84  |  -14.84  |  -26.84  |  -23.84  |  -15.84  |  -26.84  |  -29.84  |  -24.84  |  -37.84  |  -33.84  |  -31.84  |  -38.84  |  -39.84  |  -37.84  |  -31.84  |  -36.84  |     13  |         3295  |   -8.11  |  -10.11  |   -5.11  |  -24.11  |  -19.11  |  -11.11  |  -13.11  |  -16.11  |  -14.11  |  -11.11  |  -22.11  |  -18.11  |  -31.11  |  -17.11  |  -32.11  |  -29.11  |  -32.11  |  -24.11  |  -29.11  |   -9.11  |  -12.11  |  -3.11  |  14.89  |  21.89  |  34.89  |  51.89  |  43.89  |  49.89  |  49.89  |  55.89  |  47.89  |  49.89  |  41.89  |  47.89  |  43.89  |  40.89  |  37.89  |  31.89  |  25.89  |   8.89  |  16.89  |   8.89  |  14.89  |   8.89  |   9.89  |   2.89  |   1.89  |  -3.11  |  16.89  |  -5.11  |   0.89  |  20.89  |   2.89  |  -0.11  |   1.89  |  -0.11  |  19.89  |  13.89  |  16.89  |  10.89  |  -6.11  |    4.89  |   -5.11  |   -2.11  |  -12.11  |   -6.11  |   -7.11  |  -13.11  |  -10.11  |  -19.11  |   -9.11  |  -10.11  |  -16.11  |  -10.11  |  -12.11  |  -18.11  |  -16.11  |  -14.11  |   -9.11  |  -19.11  |  -16.11  |  -17.11  |  -25.11  |  -25.11  |  -26.11  |  -27.11  |  -25.11  |  -27.11  |  -34.11  |  -36.11  |     45  |
 (2007,City of London)  |  2007  |  City of London  |         7607  |       4197  |  -15.41  |  -21.41  |  -22.41  |  -24.41  |  -23.41  |  -30.41  |  -33.41  |  -32.41  |  -19.41  |  -23.41  |  -31.41  |  -13.41  |  -30.41  |  -27.41  |  -39.41  |  -39.41  |  -43.41  |  -37.41  |  -30.41  |  -19.41  |  -46.41  |  -16.41  |  -11.41  |  17.59  |  44.59  |  43.59  |  66.59  |  76.59  |  52.59  |  60.59  |  76.59  |  55.59  |  59.59  |  37.59  |  40.59  |  67.59  |  57.59  |  39.59  |  36.59  |  70.59  |  41.59  |  32.59  |  27.59  |  23.59  |  28.59  |  27.59  |  16.59  |  17.59  |  10.59  |  33.59  |  18.59  |  15.59  |   8.59  |   4.59  |  17.59  |   6.59  |  31.59  |  17.59  |   1.59  |  16.59  |   12.59  |    7.59  |   11.59  |   -0.41  |    7.59  |  -10.41  |  -20.41  |  -16.41  |   -7.41  |  -16.41  |  -24.41  |  -23.41  |  -29.41  |  -30.41  |  -30.41  |  -27.41  |  -19.41  |  -31.41  |  -31.41  |  -17.41  |  -32.41  |  -32.41  |  -28.41  |  -40.41  |  -40.41  |  -36.41  |  -42.41  |  -42.41  |  -40.41  |  -37.41  |     20  |         3410  |  -13.49  |  -13.49  |   -7.49  |  -12.49  |  -20.49  |  -20.49  |  -20.49  |  -16.49  |  -21.49  |  -16.49  |  -12.49  |  -22.49  |  -19.49  |  -33.49  |  -18.49  |  -34.49  |  -26.49  |  -13.49  |  -22.49  |  -13.49  |    1.51  |  -3.49  |  18.51  |  32.51  |  37.51  |  53.51  |  62.51  |  47.51  |  63.51  |  45.51  |  42.51  |  38.51  |  42.51  |  34.51  |  34.51  |  34.51  |  38.51  |  35.51  |  24.51  |  27.51  |   9.51  |  18.51  |  10.51  |  17.51  |  12.51  |  11.51  |   5.51  |  -1.49  |  -7.49  |  10.51  |  -8.49  |   0.51  |  16.51  |   3.51  |   1.51  |   1.51  |   1.51  |  18.51  |  14.51  |  15.51  |   8.51  |  -10.49  |    3.51  |   -2.49  |   -5.49  |  -10.49  |   -7.49  |   -5.49  |  -15.49  |  -13.49  |  -21.49  |  -10.49  |  -11.49  |  -19.49  |  -12.49  |  -14.49  |  -20.49  |  -19.49  |  -15.49  |  -14.49  |  -20.49  |  -20.49  |  -18.49  |  -26.49  |  -27.49  |  -27.49  |  -30.49  |  -28.49  |  -29.49  |  -36.49  |     36  |
 (2008,City of London)  |  2008  |  City of London  |         7429  |       4131  |  -16.62  |  -19.62  |  -23.62  |  -21.62  |  -27.62  |  -23.62  |  -32.62  |  -33.62  |  -28.62  |  -15.62  |  -25.62  |  -30.62  |  -15.62  |  -28.62  |  -35.62  |  -37.62  |  -39.62  |  -38.62  |  -34.62  |  -27.62  |  -17.62  |  -34.62  |   -2.62  |  -6.62  |  29.38  |  54.38  |  39.38  |  77.38  |  76.38  |  56.38  |  47.38  |  65.38  |  50.38  |  55.38  |  29.38  |  34.38  |  57.38  |  46.38  |  37.38  |  33.38  |  75.38  |  40.38  |  33.38  |  23.38  |  24.38  |  20.38  |  31.38  |  11.38  |  21.38  |  21.38  |  35.38  |  18.38  |  15.38  |   5.38  |   6.38  |  15.38  |   9.38  |  27.38  |  15.38  |   0.38  |   14.38  |   15.38  |    7.38  |    9.38  |   -3.62  |    7.38  |  -11.62  |  -19.62  |  -16.62  |   -6.62  |  -16.62  |  -21.62  |  -23.62  |  -28.62  |  -30.62  |  -31.62  |  -26.62  |  -21.62  |  -31.62  |  -29.62  |  -18.62  |  -32.62  |  -33.62  |  -28.62  |  -39.62  |  -39.62  |  -38.62  |  -41.62  |  -42.62  |  -40.62  |     25  |         3298  |  -24.31  |  -19.31  |  -13.31  |  -13.31  |  -12.31  |  -20.31  |  -19.31  |  -20.31  |  -17.31  |  -21.31  |  -15.31  |  -12.31  |  -21.31  |  -17.31  |  -35.31  |  -17.31  |  -36.31  |  -14.31  |  -10.31  |  -11.31  |   -1.31  |   6.69  |  -1.31  |  20.69  |  36.69  |  45.69  |  52.69  |  58.69  |  51.69  |  57.69  |  39.69  |  40.69  |  31.69  |  32.69  |  20.69  |  23.69  |  24.69  |  27.69  |  31.69  |  20.69  |  26.69  |   4.69  |  15.69  |   9.69  |  15.69  |  13.69  |  13.69  |   0.69  |  -1.31  |  -4.31  |   5.69  |  -7.31  |   1.69  |  16.69  |   3.69  |   5.69  |   5.69  |   1.69  |  15.69  |  14.69  |  14.69  |   11.69  |   -9.31  |    4.69  |   -2.31  |   -7.31  |   -6.31  |   -5.31  |   -7.31  |  -13.31  |  -14.31  |  -20.31  |   -8.31  |   -9.31  |  -16.31  |  -12.31  |  -14.31  |  -20.31  |  -21.31  |  -14.31  |  -12.31  |  -21.31  |  -19.31  |  -18.31  |  -26.31  |  -27.31  |  -27.31  |  -29.31  |  -27.31  |  -28.31  |     30  |

Weights

This example demonstrates a scenario where we wish to convert all the male and female counts to be a percentage of total count per that Borough in 2007. For example, in the City of London in 2007, the total population was 7607 people. We would like to divide all the age specific male and female counts for the City of London by this number so we can see values as a percentage of the baseline in 2007. The code below shows how a reusable ToDoubleFunction can be used to apply this logic to different parts of the frame incrementally. Note this is done all in place, so if you would want to preserve the original frame, you ought to create a copy of the frame first using DataFrame.copy().

//Load ONS population dataset
final DataFrame<Tuple,String> onsFrame = loadPopulationDataset();

//Define function to compute population weight as a percentage of 2007 value per borough
final ToDoubleFunction<DataFrameValue<Tuple,String>> compute = value -> {
    final String borough = value.rowKey().item(1);
    final Tuple rowKey2014 = Tuple.of(2007, borough);
    final double boroughCountIn2014 = onsFrame.data().getDouble(rowKey2014, "All Persons");
    return value.getDouble() / boroughCountIn2014;
};

//Apply function to various columns in order
onsFrame.cols().select(c -> c.key().matches("[MF]\\s+\\d+")).applyDoubles(compute);
onsFrame.colAt("All Males").applyDoubles(compute);
onsFrame.colAt("All Females").applyDoubles(compute);

//Print frame to std out
onsFrame.out().print(formats -> {
    formats.withDecimalFormat("All Persons", "0.0;-0.0", 1);
    formats.withDecimalFormat(Double.class, "0.00'%';-0.00'%'", 100);
});
         Index          |  Year  |     Borough      |  All Persons  |  All Males  |   M 0   |   M 1   |   M 2   |   M 3   |   M 4   |   M 5   |   M 6   |   M 7   |   M 8   |   M 9   |  M 10   |  M 11   |  M 12   |  M 13   |  M 14   |  M 15   |  M 16   |  M 17   |  M 18   |  M 19   |  M 20   |  M 21   |  M 22   |  M 23   |  M 24   |  M 25   |  M 26   |  M 27   |  M 28   |  M 29   |  M 30   |  M 31   |  M 32   |  M 33   |  M 34   |  M 35   |  M 36   |  M 37   |  M 38   |  M 39   |  M 40   |  M 41   |  M 42   |  M 43   |  M 44   |  M 45   |  M 46   |  M 47   |  M 48   |  M 49   |  M 50   |  M 51   |  M 52   |  M 53   |  M 54   |  M 55   |  M 56   |  M 57   |  M 58   |  M 59   |  M 60   |  M 61   |  M 62   |  M 63   |  M 64   |  M 65   |  M 66   |  M 67   |  M 68   |  M 69   |  M 70   |  M 71   |  M 72   |  M 73   |  M 74   |  M 75   |  M 76   |  M 77   |  M 78   |  M 79   |  M 80   |  M 81   |  M 82   |  M 83   |  M 84   |  M 85   |  M 86   |  M 87   |  M 88   |  M 89   |  M 90+  |  All Females  |   F 0   |   F 1   |   F 2   |   F 3   |   F 4   |   F 5   |   F 6   |   F 7   |   F 8   |   F 9   |  F 10   |  F 11   |  F 12   |  F 13   |  F 14   |  F 15   |  F 16   |  F 17   |  F 18   |  F 19   |  F 20   |  F 21   |  F 22   |  F 23   |  F 24   |  F 25   |  F 26   |  F 27   |  F 28   |  F 29   |  F 30   |  F 31   |  F 32   |  F 33   |  F 34   |  F 35   |  F 36   |  F 37   |  F 38   |  F 39   |  F 40   |  F 41   |  F 42   |  F 43   |  F 44   |  F 45   |  F 46   |  F 47   |  F 48   |  F 49   |  F 50   |  F 51   |  F 52   |  F 53   |  F 54   |  F 55   |  F 56   |  F 57   |  F 58   |  F 59   |  F 60   |  F 61   |  F 62   |  F 63   |  F 64   |  F 65   |  F 66   |  F 67   |  F 68   |  F 69   |  F 70   |  F 71   |  F 72   |  F 73   |  F 74   |  F 75   |  F 76   |  F 77   |  F 78   |  F 79   |  F 80   |  F 81   |  F 82   |  F 83   |  F 84   |  F 85   |  F 86   |  F 87   |  F 88   |  F 89   |  F 90+  |
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 (1999,City of London)  |  1999  |  City of London  |       6581.0  |     46.26%  |  0.32%  |  0.30%  |  0.29%  |  0.28%  |  0.26%  |  0.28%  |  0.26%  |  0.28%  |  0.26%  |  0.29%  |  0.29%  |  0.28%  |  0.25%  |  0.24%  |  0.22%  |  0.22%  |  0.22%  |  0.28%  |  0.34%  |  0.42%  |  0.53%  |  0.62%  |  0.68%  |  0.79%  |  0.85%  |  0.92%  |  0.96%  |  0.96%  |  0.96%  |  1.03%  |  1.03%  |  1.01%  |  0.99%  |  0.95%  |  0.93%  |  0.93%  |  0.85%  |  0.79%  |  0.76%  |  0.76%  |  0.75%  |  0.72%  |  0.67%  |  0.70%  |  0.70%  |  0.78%  |  0.78%  |  0.79%  |  0.85%  |  0.89%  |  0.89%  |  0.92%  |  0.83%  |  0.82%  |  0.80%  |  0.71%  |  0.64%  |  0.62%  |  0.57%  |  0.50%  |  0.46%  |  0.45%  |  0.45%  |  0.43%  |  0.42%  |  0.41%  |  0.42%  |  0.41%  |  0.39%  |  0.39%  |  0.38%  |  0.35%  |  0.34%  |  0.32%  |  0.30%  |  0.26%  |  0.26%  |  0.24%  |  0.22%  |  0.20%  |  0.18%  |  0.16%  |  0.16%  |  0.14%  |  0.14%  |  0.57%  |    NaN  |    NaN  |    NaN  |    NaN  |      0  |       40.25%  |  0.32%  |  0.32%  |  0.29%  |  0.29%  |  0.28%  |  0.28%  |  0.25%  |  0.25%  |  0.24%  |  0.24%  |  0.24%  |  0.21%  |  0.22%  |  0.21%  |  0.21%  |  0.21%  |  0.26%  |  0.33%  |  0.34%  |  0.39%  |  0.51%  |  0.62%  |  0.66%  |  0.71%  |  0.80%  |  0.89%  |  0.93%  |  0.95%  |  0.93%  |  0.96%  |  0.93%  |  0.89%  |  0.87%  |  0.82%  |  0.72%  |  0.67%  |  0.62%  |  0.57%  |  0.55%  |  0.51%  |  0.51%  |  0.54%  |  0.55%  |  0.57%  |  0.58%  |  0.53%  |  0.58%  |  0.59%  |  0.62%  |  0.63%  |  0.64%  |  0.64%  |  0.66%  |  0.60%  |  0.58%  |  0.51%  |  0.47%  |  0.45%  |  0.43%  |  0.41%  |  0.39%  |  0.38%  |  0.38%  |  0.39%  |  0.41%  |  0.39%  |  0.39%  |  0.38%  |  0.38%  |  0.37%  |  0.34%  |  0.34%  |  0.33%  |  0.30%  |  0.28%  |  0.26%  |  0.26%  |  0.25%  |  0.22%  |  0.22%  |  0.22%  |  0.21%  |  0.20%  |  0.18%  |  0.17%  |  1.00%  |    NaN  |    NaN  |    NaN  |    NaN  |      0  |
 (2000,City of London)  |  2000  |  City of London  |       7014.0  |     49.63%  |  0.33%  |  0.33%  |  0.32%  |  0.30%  |  0.29%  |  0.28%  |  0.29%  |  0.28%  |  0.29%  |  0.28%  |  0.29%  |  0.26%  |  0.24%  |  0.21%  |  0.21%  |  0.20%  |  0.22%  |  0.25%  |  0.32%  |  0.39%  |  0.51%  |  0.63%  |  0.75%  |  0.84%  |  0.95%  |  1.06%  |  1.16%  |  1.18%  |  1.18%  |  1.20%  |  1.24%  |  1.24%  |  1.18%  |  1.13%  |  1.06%  |  1.05%  |  1.00%  |  0.92%  |  0.85%  |  0.82%  |  0.82%  |  0.82%  |  0.78%  |  0.74%  |  0.74%  |  0.74%  |  0.82%  |  0.82%  |  0.82%  |  0.88%  |  0.93%  |  0.93%  |  0.97%  |  0.87%  |  0.84%  |  0.83%  |  0.74%  |  0.66%  |  0.62%  |  0.57%  |  0.51%  |  0.45%  |  0.42%  |  0.41%  |  0.39%  |  0.38%  |  0.37%  |  0.37%  |  0.35%  |  0.37%  |  0.35%  |  0.34%  |  0.33%  |  0.30%  |  0.29%  |  0.29%  |  0.25%  |  0.25%  |  0.22%  |  0.21%  |  0.20%  |  0.18%  |  0.16%  |  0.16%  |  0.14%  |  0.51%  |    NaN  |    NaN  |    NaN  |    NaN  |      0  |       42.58%  |  0.34%  |  0.32%  |  0.32%  |  0.29%  |  0.28%  |  0.28%  |  0.26%  |  0.25%  |  0.25%  |  0.25%  |  0.25%  |  0.24%  |  0.22%  |  0.24%  |  0.22%  |  0.24%  |  0.26%  |  0.30%  |  0.37%  |  0.42%  |  0.50%  |  0.64%  |  0.76%  |  0.80%  |  0.91%  |  0.99%  |  1.08%  |  1.09%  |  1.10%  |  1.06%  |  1.05%  |  1.00%  |  0.96%  |  0.91%  |  0.84%  |  0.75%  |  0.70%  |  0.63%  |  0.58%  |  0.57%  |  0.54%  |  0.55%  |  0.54%  |  0.57%  |  0.57%  |  0.58%  |  0.54%  |  0.59%  |  0.59%  |  0.62%  |  0.64%  |  0.66%  |  0.67%  |  0.67%  |  0.62%  |  0.59%  |  0.54%  |  0.49%  |  0.46%  |  0.42%  |  0.39%  |  0.38%  |  0.37%  |  0.35%  |  0.37%  |  0.38%  |  0.37%  |  0.37%  |  0.37%  |  0.37%  |  0.35%  |  0.33%  |  0.33%  |  0.32%  |  0.29%  |  0.28%  |  0.25%  |  0.26%  |  0.25%  |  0.22%  |  0.21%  |  0.20%  |  0.20%  |  0.20%  |  0.17%  |  1.06%  |    NaN  |    NaN  |    NaN  |    NaN  |      0  |
 (2001,City of London)  |  2001  |  City of London  |       7359.0  |     52.37%  |  0.22%  |  0.39%  |  0.33%  |  0.25%  |  0.28%  |  0.33%  |  0.26%  |  0.21%  |  0.25%  |  0.35%  |  0.34%  |  0.21%  |  0.38%  |  0.25%  |  0.14%  |  0.18%  |  0.16%  |  0.17%  |  0.16%  |  0.35%  |  0.50%  |  0.51%  |  0.70%  |  0.83%  |  1.05%  |  1.45%  |  1.45%  |  1.31%  |  1.42%  |  1.64%  |  1.50%  |  1.25%  |  1.22%  |  1.38%  |  1.30%  |  1.10%  |  1.17%  |  0.93%  |  0.83%  |  0.99%  |  0.85%  |  0.68%  |  0.62%  |  1.00%  |  0.96%  |  0.71%  |  0.64%  |  0.59%  |  0.79%  |  0.64%  |  1.46%  |  0.96%  |  0.72%  |  1.06%  |  1.05%  |  0.80%  |  0.83%  |  0.74%  |  0.84%  |  0.63%  |  0.37%  |  0.45%  |  0.59%  |  0.47%  |  0.33%  |  0.37%  |  0.28%  |  0.37%  |  0.28%  |  0.35%  |  0.35%  |  0.28%  |  0.32%  |  0.38%  |  0.28%  |  0.25%  |  0.30%  |  0.26%  |  0.14%  |  0.25%  |  0.20%  |  0.18%  |  0.11%  |  0.20%  |  0.13%  |  0.08%  |  0.13%  |  0.07%  |  0.05%  |  0.04%  |     13  |       44.37%  |  0.42%  |  0.39%  |  0.30%  |  0.28%  |  0.34%  |  0.21%  |  0.28%  |  0.20%  |  0.24%  |  0.32%  |  0.26%  |  0.26%  |  0.13%  |  0.34%  |  0.17%  |  0.17%  |  0.18%  |  0.51%  |  0.37%  |  0.46%  |  0.62%  |  0.51%  |  0.64%  |  0.71%  |  0.97%  |  1.22%  |  1.17%  |  1.05%  |  1.10%  |  1.41%  |  1.12%  |  1.09%  |  1.33%  |  0.87%  |  0.79%  |  0.71%  |  0.87%  |  0.79%  |  0.63%  |  0.59%  |  0.49%  |  0.37%  |  0.41%  |  0.83%  |  0.57%  |  0.70%  |  0.66%  |  0.62%  |  0.46%  |  0.55%  |  0.49%  |  0.85%  |  0.63%  |  0.75%  |  0.75%  |  0.50%  |  0.59%  |  0.50%  |  0.50%  |  0.43%  |  0.42%  |  0.42%  |  0.34%  |  0.33%  |  0.32%  |  0.38%  |  0.37%  |  0.35%  |  0.45%  |  0.35%  |  0.26%  |  0.34%  |  0.32%  |  0.41%  |  0.24%  |  0.32%  |  0.35%  |  0.17%  |  0.17%  |  0.20%  |  0.24%  |  0.29%  |  0.24%  |  0.14%  |  0.13%  |  0.13%  |  0.18%  |  0.34%  |  0.21%  |  0.09%  |     15  |
 (2002,City of London)  |  2002  |  City of London  |       7280.0  |     52.16%  |  0.38%  |  0.24%  |  0.37%  |  0.35%  |  0.26%  |  0.26%  |  0.32%  |  0.26%  |  0.22%  |  0.26%  |  0.33%  |  0.33%  |  0.18%  |  0.35%  |  0.12%  |  0.07%  |  0.11%  |  0.13%  |  0.16%  |  0.13%  |  0.26%  |  0.51%  |  0.66%  |  0.80%  |  0.89%  |  1.30%  |  1.49%  |  1.60%  |  1.34%  |  1.50%  |  1.50%  |  1.41%  |  1.30%  |  1.17%  |  1.33%  |  1.22%  |  1.10%  |  1.01%  |  0.96%  |  0.80%  |  1.03%  |  0.85%  |  0.75%  |  0.66%  |  0.99%  |  0.95%  |  0.74%  |  0.66%  |  0.59%  |  0.80%  |  0.60%  |  1.49%  |  0.92%  |  0.64%  |  1.12%  |  1.00%  |  0.78%  |  0.80%  |  0.72%  |  0.79%  |  0.59%  |  0.37%  |  0.41%  |  0.60%  |  0.53%  |  0.30%  |  0.34%  |  0.26%  |  0.33%  |  0.28%  |  0.32%  |  0.39%  |  0.28%  |  0.33%  |  0.38%  |  0.26%  |  0.24%  |  0.28%  |  0.22%  |  0.14%  |  0.22%  |  0.18%  |  0.17%  |  0.11%  |  0.20%  |  0.12%  |  0.08%  |  0.11%  |  0.05%  |  0.03%  |     14  |       43.54%  |  0.37%  |  0.46%  |  0.39%  |  0.25%  |  0.28%  |  0.34%  |  0.20%  |  0.26%  |  0.17%  |  0.24%  |  0.22%  |  0.20%  |  0.22%  |  0.08%  |  0.25%  |  0.17%  |  0.07%  |  0.20%  |  0.46%  |  0.38%  |  0.46%  |  0.63%  |  0.68%  |  0.62%  |  0.88%  |  0.97%  |  1.10%  |  1.10%  |  1.09%  |  0.92%  |  1.51%  |  1.10%  |  1.24%  |  1.33%  |  0.83%  |  0.80%  |  0.75%  |  0.76%  |  0.82%  |  0.58%  |  0.62%  |  0.49%  |  0.37%  |  0.43%  |  0.79%  |  0.47%  |  0.62%  |  0.68%  |  0.59%  |  0.47%  |  0.50%  |  0.54%  |  0.83%  |  0.67%  |  0.71%  |  0.72%  |  0.49%  |  0.54%  |  0.53%  |  0.47%  |  0.39%  |  0.38%  |  0.39%  |  0.35%  |  0.30%  |  0.30%  |  0.37%  |  0.37%  |  0.33%  |  0.45%  |  0.33%  |  0.25%  |  0.32%  |  0.30%  |  0.41%  |  0.25%  |  0.33%  |  0.34%  |  0.13%  |  0.16%  |  0.18%  |  0.22%  |  0.29%  |  0.20%  |  0.12%  |  0.13%  |  0.09%  |  0.14%  |  0.34%  |  0.18%  |     20  |
 (2003,City of London)  |  2003  |  City of London  |       7115.0  |     51.16%  |  0.46%  |  0.32%  |  0.21%  |  0.29%  |  0.34%  |  0.22%  |  0.25%  |  0.32%  |  0.28%  |  0.28%  |  0.32%  |  0.33%  |  0.28%  |  0.13%  |  0.21%  |  0.13%  |  0.05%  |  0.07%  |  0.16%  |  0.16%  |  0.14%  |  0.25%  |  0.64%  |  0.79%  |  0.87%  |  1.05%  |  1.31%  |  1.55%  |  1.50%  |  1.38%  |  1.42%  |  1.38%  |  1.30%  |  1.24%  |  1.12%  |  1.28%  |  1.17%  |  1.08%  |  1.00%  |  0.91%  |  0.83%  |  0.97%  |  0.84%  |  0.75%  |  0.67%  |  0.99%  |  0.97%  |  0.74%  |  0.67%  |  0.51%  |  0.84%  |  0.58%  |  1.42%  |  0.85%  |  0.62%  |  1.05%  |  0.97%  |  0.74%  |  0.80%  |  0.72%  |  0.72%  |  0.58%  |  0.34%  |  0.39%  |  0.55%  |  0.47%  |  0.30%  |  0.32%  |  0.29%  |  0.29%  |  0.24%  |  0.30%  |  0.41%  |  0.24%  |  0.32%  |  0.35%  |  0.25%  |  0.22%  |  0.29%  |  0.20%  |  0.13%  |  0.21%  |  0.16%  |  0.13%  |  0.11%  |  0.18%  |  0.11%  |  0.08%  |  0.09%  |  0.03%  |     13  |       42.37%  |  0.24%  |  0.33%  |  0.41%  |  0.38%  |  0.24%  |  0.28%  |  0.34%  |  0.18%  |  0.25%  |  0.16%  |  0.25%  |  0.17%  |  0.14%  |  0.16%  |  0.03%  |  0.21%  |  0.09%  |  0.16%  |  0.29%  |  0.41%  |  0.45%  |  0.49%  |  0.68%  |  0.80%  |  0.76%  |  1.12%  |  0.96%  |  1.13%  |  1.08%  |  1.12%  |  0.99%  |  1.30%  |  1.12%  |  1.17%  |  1.21%  |  0.79%  |  0.76%  |  0.59%  |  0.67%  |  0.70%  |  0.55%  |  0.62%  |  0.58%  |  0.38%  |  0.46%  |  0.78%  |  0.50%  |  0.54%  |  0.64%  |  0.51%  |  0.46%  |  0.53%  |  0.49%  |  0.80%  |  0.64%  |  0.70%  |  0.66%  |  0.46%  |  0.53%  |  0.45%  |  0.47%  |  0.39%  |  0.38%  |  0.39%  |  0.35%  |  0.32%  |  0.30%  |  0.37%  |  0.39%  |  0.33%  |  0.42%  |  0.32%  |  0.22%  |  0.30%  |  0.28%  |  0.39%  |  0.21%  |  0.30%  |  0.32%  |  0.13%  |  0.14%  |  0.18%  |  0.20%  |  0.21%  |  0.21%  |  0.12%  |  0.03%  |  0.07%  |  0.13%  |  0.29%  |     26  |
 (2004,City of London)  |  2004  |  City of London  |       7118.0  |     50.94%  |  0.37%  |  0.35%  |  0.33%  |  0.21%  |  0.26%  |  0.35%  |  0.22%  |  0.26%  |  0.41%  |  0.24%  |  0.29%  |  0.28%  |  0.29%  |  0.21%  |  0.05%  |  0.17%  |  0.11%  |  0.00%  |  0.03%  |  0.17%  |  0.12%  |  0.33%  |  0.34%  |  0.83%  |  0.92%  |  0.91%  |  1.17%  |  1.47%  |  1.51%  |  1.52%  |  1.31%  |  1.22%  |  1.34%  |  1.22%  |  1.13%  |  1.04%  |  1.30%  |  1.21%  |  1.16%  |  1.06%  |  0.96%  |  0.78%  |  0.85%  |  0.88%  |  0.76%  |  0.64%  |  1.00%  |  0.92%  |  0.72%  |  0.66%  |  0.58%  |  0.80%  |  0.59%  |  1.30%  |  0.85%  |  0.60%  |  1.01%  |  1.00%  |  0.72%  |  0.75%  |  0.70%  |  0.75%  |  0.57%  |  0.37%  |  0.42%  |  0.51%  |  0.45%  |  0.29%  |  0.33%  |  0.28%  |  0.29%  |  0.24%  |  0.26%  |  0.39%  |  0.21%  |  0.32%  |  0.37%  |  0.25%  |  0.18%  |  0.26%  |  0.12%  |  0.16%  |  0.18%  |  0.13%  |  0.11%  |  0.11%  |  0.20%  |  0.11%  |  0.07%  |  0.07%  |     12  |       42.63%  |  0.41%  |  0.24%  |  0.26%  |  0.34%  |  0.33%  |  0.26%  |  0.33%  |  0.37%  |  0.18%  |  0.25%  |  0.09%  |  0.25%  |  0.13%  |  0.12%  |  0.12%  |  0.01%  |  0.17%  |  0.22%  |  0.12%  |  0.29%  |  0.50%  |  0.54%  |  0.62%  |  0.78%  |  1.04%  |  1.05%  |  1.20%  |  1.13%  |  1.04%  |  1.06%  |  1.04%  |  1.03%  |  1.20%  |  1.05%  |  1.14%  |  1.09%  |  0.74%  |  0.80%  |  0.62%  |  0.63%  |  0.72%  |  0.53%  |  0.59%  |  0.51%  |  0.39%  |  0.45%  |  0.78%  |  0.49%  |  0.51%  |  0.74%  |  0.50%  |  0.43%  |  0.50%  |  0.47%  |  0.79%  |  0.67%  |  0.68%  |  0.67%  |  0.45%  |  0.53%  |  0.46%  |  0.45%  |  0.37%  |  0.42%  |  0.37%  |  0.35%  |  0.33%  |  0.26%  |  0.38%  |  0.37%  |  0.32%  |  0.39%  |  0.32%  |  0.20%  |  0.28%  |  0.29%  |  0.38%  |  0.20%  |  0.30%  |  0.29%  |  0.16%  |  0.14%  |  0.16%  |  0.14%  |  0.16%  |  0.16%  |  0.09%  |  0.01%  |  0.04%  |  0.12%  |     42  |
 (2005,City of London)  |  2005  |  City of London  |       7131.0  |     50.86%  |  0.45%  |  0.33%  |  0.29%  |  0.30%  |  0.16%  |  0.25%  |  0.29%  |  0.25%  |  0.25%  |  0.41%  |  0.26%  |  0.28%  |  0.26%  |  0.25%  |  0.05%  |  0.04%  |  0.16%  |  0.13%  |  0.00%  |  0.09%  |  0.12%  |  0.21%  |  0.57%  |  0.53%  |  0.95%  |  1.22%  |  0.97%  |  1.17%  |  1.54%  |  1.49%  |  1.37%  |  1.16%  |  1.21%  |  1.43%  |  1.29%  |  1.01%  |  1.00%  |  1.35%  |  1.17%  |  1.03%  |  1.05%  |  0.89%  |  0.80%  |  0.91%  |  0.82%  |  0.76%  |  0.67%  |  1.08%  |  0.88%  |  0.76%  |  0.68%  |  0.55%  |  0.78%  |  0.66%  |  1.17%  |  0.88%  |  0.62%  |  0.96%  |  0.92%  |  0.72%  |  0.76%  |  0.66%  |  0.70%  |  0.55%  |  0.35%  |  0.39%  |  0.55%  |  0.41%  |  0.30%  |  0.32%  |  0.26%  |  0.22%  |  0.22%  |  0.25%  |  0.39%  |  0.20%  |  0.28%  |  0.35%  |  0.22%  |  0.18%  |  0.28%  |  0.11%  |  0.18%  |  0.16%  |  0.09%  |  0.09%  |  0.08%  |  0.18%  |  0.09%  |  0.03%  |     12  |       42.88%  |  0.38%  |  0.38%  |  0.20%  |  0.20%  |  0.30%  |  0.33%  |  0.22%  |  0.30%  |  0.33%  |  0.18%  |  0.24%  |  0.09%  |  0.26%  |  0.09%  |  0.09%  |  0.08%  |  0.03%  |  0.09%  |  0.25%  |  0.20%  |  0.41%  |  0.57%  |  0.64%  |  0.66%  |  1.08%  |  1.00%  |  1.17%  |  1.17%  |  1.12%  |  1.00%  |  1.18%  |  1.00%  |  1.12%  |  1.20%  |  0.97%  |  1.05%  |  0.97%  |  0.79%  |  0.72%  |  0.68%  |  0.59%  |  0.68%  |  0.57%  |  0.62%  |  0.50%  |  0.45%  |  0.45%  |  0.72%  |  0.43%  |  0.50%  |  0.75%  |  0.50%  |  0.47%  |  0.51%  |  0.49%  |  0.76%  |  0.68%  |  0.72%  |  0.66%  |  0.45%  |  0.49%  |  0.46%  |  0.49%  |  0.34%  |  0.43%  |  0.39%  |  0.33%  |  0.32%  |  0.24%  |  0.35%  |  0.34%  |  0.26%  |  0.37%  |  0.29%  |  0.24%  |  0.28%  |  0.32%  |  0.34%  |  0.21%  |  0.28%  |  0.29%  |  0.13%  |  0.16%  |  0.14%  |  0.13%  |  0.16%  |  0.12%  |  0.03%  |  0.03%  |  0.04%  |     50  |
 (2006,City of London)  |  2006  |  City of London  |       7254.0  |     52.04%  |  0.34%  |  0.33%  |  0.34%  |  0.26%  |  0.24%  |  0.17%  |  0.21%  |  0.30%  |  0.29%  |  0.24%  |  0.39%  |  0.24%  |  0.26%  |  0.22%  |  0.09%  |  0.07%  |  0.07%  |  0.20%  |  0.16%  |  0.00%  |  0.16%  |  0.25%  |  0.42%  |  0.83%  |  0.83%  |  1.08%  |  1.43%  |  1.09%  |  1.30%  |  1.63%  |  1.50%  |  1.35%  |  1.09%  |  1.12%  |  1.52%  |  1.29%  |  1.01%  |  0.97%  |  1.41%  |  1.14%  |  0.99%  |  1.08%  |  0.89%  |  0.83%  |  0.91%  |  0.78%  |  0.82%  |  0.70%  |  1.09%  |  0.87%  |  0.79%  |  0.68%  |  0.63%  |  0.83%  |  0.63%  |  1.12%  |  0.88%  |  0.62%  |  0.89%  |  0.82%  |  0.74%  |  0.74%  |  0.63%  |  0.71%  |  0.53%  |  0.37%  |  0.34%  |  0.54%  |  0.41%  |  0.29%  |  0.30%  |  0.26%  |  0.18%  |  0.21%  |  0.25%  |  0.38%  |  0.22%  |  0.26%  |  0.37%  |  0.22%  |  0.18%  |  0.25%  |  0.08%  |  0.13%  |  0.16%  |  0.07%  |  0.05%  |  0.08%  |  0.16%  |  0.09%  |     13  |       43.32%  |  0.37%  |  0.34%  |  0.41%  |  0.16%  |  0.22%  |  0.33%  |  0.30%  |  0.26%  |  0.29%  |  0.33%  |  0.18%  |  0.24%  |  0.07%  |  0.25%  |  0.05%  |  0.09%  |  0.05%  |  0.16%  |  0.09%  |  0.35%  |  0.32%  |  0.43%  |  0.67%  |  0.76%  |  0.93%  |  1.16%  |  1.05%  |  1.13%  |  1.13%  |  1.21%  |  1.10%  |  1.13%  |  1.03%  |  1.10%  |  1.05%  |  1.01%  |  0.97%  |  0.89%  |  0.82%  |  0.59%  |  0.70%  |  0.59%  |  0.67%  |  0.59%  |  0.60%  |  0.51%  |  0.50%  |  0.43%  |  0.70%  |  0.41%  |  0.49%  |  0.75%  |  0.51%  |  0.47%  |  0.50%  |  0.47%  |  0.74%  |  0.66%  |  0.70%  |  0.62%  |  0.39%  |  0.54%  |  0.41%  |  0.45%  |  0.32%  |  0.39%  |  0.38%  |  0.30%  |  0.34%  |  0.22%  |  0.35%  |  0.34%  |  0.26%  |  0.34%  |  0.32%  |  0.24%  |  0.26%  |  0.29%  |  0.35%  |  0.22%  |  0.26%  |  0.25%  |  0.14%  |  0.14%  |  0.13%  |  0.12%  |  0.14%  |  0.12%  |  0.03%  |  0.00%  |     45  |
 (2007,City of London)  |  2007  |  City of London  |       7607.0  |     55.17%  |  0.41%  |  0.33%  |  0.32%  |  0.29%  |  0.30%  |  0.21%  |  0.17%  |  0.18%  |  0.35%  |  0.30%  |  0.20%  |  0.43%  |  0.21%  |  0.25%  |  0.09%  |  0.09%  |  0.04%  |  0.12%  |  0.21%  |  0.35%  |  0.00%  |  0.39%  |  0.46%  |  0.84%  |  1.20%  |  1.18%  |  1.49%  |  1.62%  |  1.30%  |  1.41%  |  1.62%  |  1.34%  |  1.39%  |  1.10%  |  1.14%  |  1.50%  |  1.37%  |  1.13%  |  1.09%  |  1.54%  |  1.16%  |  1.04%  |  0.97%  |  0.92%  |  0.99%  |  0.97%  |  0.83%  |  0.84%  |  0.75%  |  1.05%  |  0.85%  |  0.82%  |  0.72%  |  0.67%  |  0.84%  |  0.70%  |  1.03%  |  0.84%  |  0.63%  |  0.83%  |  0.78%  |  0.71%  |  0.76%  |  0.60%  |  0.71%  |  0.47%  |  0.34%  |  0.39%  |  0.51%  |  0.39%  |  0.29%  |  0.30%  |  0.22%  |  0.21%  |  0.21%  |  0.25%  |  0.35%  |  0.20%  |  0.20%  |  0.38%  |  0.18%  |  0.18%  |  0.24%  |  0.08%  |  0.08%  |  0.13%  |  0.05%  |  0.05%  |  0.08%  |  0.12%  |     20  |       44.83%  |  0.32%  |  0.32%  |  0.39%  |  0.33%  |  0.22%  |  0.22%  |  0.22%  |  0.28%  |  0.21%  |  0.28%  |  0.33%  |  0.20%  |  0.24%  |  0.05%  |  0.25%  |  0.04%  |  0.14%  |  0.32%  |  0.20%  |  0.32%  |  0.51%  |  0.45%  |  0.74%  |  0.92%  |  0.99%  |  1.20%  |  1.31%  |  1.12%  |  1.33%  |  1.09%  |  1.05%  |  1.00%  |  1.05%  |  0.95%  |  0.95%  |  0.95%  |  1.00%  |  0.96%  |  0.82%  |  0.85%  |  0.62%  |  0.74%  |  0.63%  |  0.72%  |  0.66%  |  0.64%  |  0.57%  |  0.47%  |  0.39%  |  0.63%  |  0.38%  |  0.50%  |  0.71%  |  0.54%  |  0.51%  |  0.51%  |  0.51%  |  0.74%  |  0.68%  |  0.70%  |  0.60%  |  0.35%  |  0.54%  |  0.46%  |  0.42%  |  0.35%  |  0.39%  |  0.42%  |  0.29%  |  0.32%  |  0.21%  |  0.35%  |  0.34%  |  0.24%  |  0.33%  |  0.30%  |  0.22%  |  0.24%  |  0.29%  |  0.30%  |  0.22%  |  0.22%  |  0.25%  |  0.14%  |  0.13%  |  0.13%  |  0.09%  |  0.12%  |  0.11%  |  0.01%  |     36  |
 (2008,City of London)  |  2008  |  City of London  |       7429.0  |     54.31%  |  0.38%  |  0.34%  |  0.29%  |  0.32%  |  0.24%  |  0.29%  |  0.17%  |  0.16%  |  0.22%  |  0.39%  |  0.26%  |  0.20%  |  0.39%  |  0.22%  |  0.13%  |  0.11%  |  0.08%  |  0.09%  |  0.14%  |  0.24%  |  0.37%  |  0.14%  |  0.57%  |  0.51%  |  0.99%  |  1.31%  |  1.12%  |  1.62%  |  1.60%  |  1.34%  |  1.22%  |  1.46%  |  1.26%  |  1.33%  |  0.99%  |  1.05%  |  1.35%  |  1.21%  |  1.09%  |  1.04%  |  1.59%  |  1.13%  |  1.04%  |  0.91%  |  0.92%  |  0.87%  |  1.01%  |  0.75%  |  0.88%  |  0.88%  |  1.06%  |  0.84%  |  0.80%  |  0.67%  |  0.68%  |  0.80%  |  0.72%  |  0.96%  |  0.80%  |  0.60%  |  0.79%  |  0.80%  |  0.70%  |  0.72%  |  0.55%  |  0.70%  |  0.45%  |  0.34%  |  0.38%  |  0.51%  |  0.38%  |  0.32%  |  0.29%  |  0.22%  |  0.20%  |  0.18%  |  0.25%  |  0.32%  |  0.18%  |  0.21%  |  0.35%  |  0.17%  |  0.16%  |  0.22%  |  0.08%  |  0.08%  |  0.09%  |  0.05%  |  0.04%  |  0.07%  |     25  |       43.35%  |  0.16%  |  0.22%  |  0.30%  |  0.30%  |  0.32%  |  0.21%  |  0.22%  |  0.21%  |  0.25%  |  0.20%  |  0.28%  |  0.32%  |  0.20%  |  0.25%  |  0.01%  |  0.25%  |  0.00%  |  0.29%  |  0.34%  |  0.33%  |  0.46%  |  0.57%  |  0.46%  |  0.75%  |  0.96%  |  1.08%  |  1.17%  |  1.25%  |  1.16%  |  1.24%  |  1.00%  |  1.01%  |  0.89%  |  0.91%  |  0.75%  |  0.79%  |  0.80%  |  0.84%  |  0.89%  |  0.75%  |  0.83%  |  0.54%  |  0.68%  |  0.60%  |  0.68%  |  0.66%  |  0.66%  |  0.49%  |  0.46%  |  0.42%  |  0.55%  |  0.38%  |  0.50%  |  0.70%  |  0.53%  |  0.55%  |  0.55%  |  0.50%  |  0.68%  |  0.67%  |  0.67%  |  0.63%  |  0.35%  |  0.54%  |  0.45%  |  0.38%  |  0.39%  |  0.41%  |  0.38%  |  0.30%  |  0.29%  |  0.21%  |  0.37%  |  0.35%  |  0.26%  |  0.32%  |  0.29%  |  0.21%  |  0.20%  |  0.29%  |  0.32%  |  0.20%  |  0.22%  |  0.24%  |  0.13%  |  0.12%  |  0.12%  |  0.09%  |  0.12%  |  0.11%  |     30  |