def d2cd(d, e):
    """Transform from *d* value to column *cd* count value, using the
    *e.css('cd')* (column depth) as column measure."""
    cd = e.css('cd', 0)
    if cd + e.gd:
        return (d + e.gd) / (cd + e.gd)
    return 0
