You are correct that the lookup transform only finds the first matching index - it's a one-sided join, not a multi-join. If you want to join multiple data entries per key, you'll have to use a dataset with multiple columns.
For your data, you can produce such a dataset using the pandas [pivot](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.pivot.html) method, and then within Altair you can undo this operation with the [fold transform](https://altair-viz.github.io/user_guide/transform.html#fold-transform)
For your data it might look something like this (note: since I don't have access to your dataset I haven't run this code, so there may be typos. In the future please try to include sample data with your question if possible):
```
import altair as alt
from vega_datasets import data
us_counties = alt.topo_feature(data.us_10m.url, 'counties')
fdf = get_fdf_data() # fill this in
fdf = fdf.pivot(index='fips', columns='year', values='Pill_per_pop').reset_index()
columns = [str(year) for year in range(2006, 2013)]
slider = alt.binding_range(min=2006, max=2012, step=1)
select_year = alt.selection_single(name="year", fields=['year'],
bind=slider, init={'year': 2006})
alt.Chart(us_counties).mark_geoshape(
stroke='black',
strokeWidth=0.05
).project(
type='albersUsa'
).transform_lookup(
lookup='id',
from_=alt.LookupData(fdf, 'fips', columns)
).transform_fold(
columns, as_=['year', 'Pill_per_pop']
).transform_calculate(
year='parseInt(datum.year)',
Pill_per_pop='isValid(datum.Pill_per_pop) ? datum.Pill_per_pop : -1'
).encode(
color = alt.condition(
'datum.Pill_per_pop > 0',
alt.Color('Pill_per_pop:Q', scale=Scale(scheme='blues')),
alt.value('#dbe9f6')
)).add_selection(
select_year
).properties(
width=700,
height=400
).transform_filter(
select_year
)
```
I'm not sure why, but it seems like the null values are breaking the conditional encoding. I was able to get it working by using a calculate transform to turn nulls into negative numbers, and then conditioning on this instead:
```
alt.Chart(us_counties).mark_geoshape(
stroke='black',
strokeWidth=0.05
).project(
type='albersUsa'
).transform_lookup(
lookup='id',
from_=alt.LookupData(fdf1, 'fips', ['Pill_per_pop'])
).transform_calculate(
Pill_per_pop='isValid(datum.Pill_per_pop) ? datum.Pill_per_pop : -1'
).encode(
color = alt.condition(
'datum.Pill_per_pop > 0',
alt.Color('Pill_per_pop:Q', scale=Scale(scheme='blues')),
alt.value('#dbe9f6')
)
).properties(
width=700,
height=400
)
```