Many times you have data with null values and you’d like to fill them with non-null values. For example, imagine this is your data:
You could replace them by a constant value like this:
Start building with Tinybird!
If you've read this far, you might want to use Tinybird as your analytics backend. You can just get started, on the free plan.
But in many cases you’ll want to fill them with the latest (or next) value available. This is a one-liner in libraries like Pandas with the fillna method, and on Postgres this way. On ClickHouse is also possible using array functions:
Here is a full explanation on what happens in each of the subqueries of this last query and of what each of the array functions does.
Subscribe to our newsletter
Get 10 links weekly to the Data and AI articles the Tinybird team is reading.