Electricity meters in New York (America/New_York) write readings into one shared log. readings has meter_id and local_ts — the meter's own wall clock as a "YYYY-MM-DD HH:MM" string, with no zone. Rows are in the order they were written; for any one meter that is also the order in time. Several meters' rows are interleaved.
Convert every reading to UTC, using these rules:
- •The repeated hour. On 2024-11-03 the clocks went back at 02:00 EDT to 01:00 EST, so 01:00–01:59 happened twice. A meter's reading in that hour is EDT (UTC−4) until that meter's clock goes back, and EST (UTC−5) from the reading where it goes back onwards. A meter's clock has gone back at its first reading whose
local_ts is earlier than that meter's previous reading. - •The missing hour. On 2024-03-10 the clocks jumped from 02:00 to 03:00, so 02:00–02:59 never existed. A reading stamped in that hour comes from a meter that hadn't moved its clock yet: read it as EST (UTC−5).
- •Every other reading has exactly one meaning.
Return a list of UTC times as "YYYY-MM-DD HH:MM" strings, one per row, in the input order.
Python 3.13 in your browser — the standard library plus pandas and numpy; no pip installs.