horse running in field

If you pull a column of UK horse racing distances out of a results database, you do not get a tidy list of fives, sixes and sevens. You get about 1,900 different strings. They look like 6f, 1m 2f, 2m 110y and 7f 14y, and more than half of all races carry an odd number of yards on the end.

That column deserves a closer look, and so does its neighbour, the surface column, which holds something quite different from what you would guess.

What the distance field looks like

Of the 197,432 UK and Irish races whose distance we could parse, 109,853 have a yards part, which is 56%. A race over 7f 14y is not a seven furlong race with a typo. The extra yards usually reflect where the start sits on that course, and they can differ for the same nominal distance at different tracks.

That has two consequences. You cannot group by the string and expect sensible buckets, because 7f, 7f 14y and 7f 36y are three different groups. And you should store the length in one numeric unit as well as the original text. Here is a converter that handles every format we have seen:

import re

def metres(distance):
    m = re.fullmatch(r"\s*(?:(\d+)m)?\s*(?:(\d+)f)?\s*(?:(\d+)y)?\s*", distance)
    if not m or not any(m.groups()):
        return None
    miles, furlongs, yards = (int(x or 0) for x in m.groups())
    return miles * 1609.344 + furlongs * 201.168 + yards * 0.9144

metres("1m 2f")      # 2011.68
metres("2m 110y")    # 3319.27
metres("7f 14y")     # 1420.98

A small number of races have a suffix such as (Str), which marks a straight course. There are 94 of them in the archive, and the function returns None, which is what you want, because you should decide how to treat them.

Short and long

The shortest race we hold is 4f 214y, an all-weather sprint run 537 times. The longest are over four miles and are almost all steeplechases, with the very longest at 4m 4f.

Counting every race by its length in metres gives a clear picture:

LengthRacesShare
Under 1,400 m37,10419%
1,400 to 1,999 m48,74025%
2,000 to 2,999 m28,85315%
3,000 to 3,999 m44,28622%
4,000 m or more38,44919%

The shape is bimodal. Flat racing fills the first three rows, and jump racing sits almost entirely in the last two, since all but 92 of the 71,992 chases and hurdles run over 3,000 metres. Only about 9% of flat races go that far. A long distance is therefore a strong hint that a race is over jumps, so expect race type and distance to overlap if you put both in one model.

The commonest single distances are 6f (12,284 races), 2m (12,101), 7f (11,597), 1m (11,061) and 5f (7,986). Those five account for 28% of all races. The rest is a long tail of odd yardages.

The surface column is really the going

The part that surprises people is the surface field on a UK race. It is not a list of Turf, Polytrack and Tapeta. For turf it holds the going, and for all-weather it holds the type of surface. The twelve most common values:

ValueRaces
Good24,143
Standard (AW – Polytrack)18,850
Standard (AW – Tapeta)13,658
Soft12,294
Good to Firm10,566
Good (Good to Firm in places)9,235
Good to Soft8,168
Heavy7,465
Good to Firm (Good in places)7,042
Good (Good to Soft in places)6,395
Good to Soft (Soft in places)4,979
Good to Soft (Good in places)4,616

So one column mixes the ground condition and the all-weather type. Polytrack and Tapeta together cover 32,508 of the 45,460 all-weather races, which means about 13,000 all-weather races carry some other label. Never count all-weather racing by matching those two strings. If you want to separate turf from all-weather, use the race type (Flat Turf, Flat AW, Hurdle or Chase) rather than the surface text. And if you want the going as an ordered scale, you will need to parse the “in places” qualifiers, which change a Good into something slightly firmer or softer.

Putting it to use

For modelling, two columns are worth deriving: the distance in metres, and a going score on a numeric scale, with the qualifiers split off. Keep the raw text beside both.

Derive the metres and a going score once, keep the original text, and move on. The fields are on every race in the UK datasets and the API races endpoints. UK horse racing data shows what else is recorded, and the racecourse ranking shows where the races are run.

Comments are closed

0
    0
    Your Cart
    Your cart is emptyReturn to Shop