Lesson 10.5 · Pro
Forward fill and back fill
Fill gaps with the last known value (or the next one), the Postgres way.
In this lesson
- The problem: gaps after filling the calendar
- Step 1: number the groups with a running COUNT
- Step 2: spread the known value across its group
- Back fill: the next known value
Go Pro to read this lesson
Pro unlocks every lesson and practice problem in SQL, Python, pandas and NumPy, with answers and step-by-step explanations.