You are given two time-sorted lists of sensor readings:
(time, city, reading)
(time, city, reading)
Example:
Temperature
[(1, 'NYC', 12),
(5, 'SFO', 20),
(7, 'NYC', 23),
(16, 'SFO', 10)]
Humidity
[(0, 'SFO', 12),
(3, 'SFO', 2),
(6, 'NYC', 2),
(19, 'SFO', 9)]
For each temperature record, match it with the most recent humidity record from the same city whose time <= temperature_time.
null
(or
None
) for the humidity reading.
Return a list aligned to the temperature records, where each element includes the temperature record and the matched humidity reading (or null).