Replace empty value based on condition on another row
![magic_mike](https://us.v-cdn.net/6038231/uploads/Dataiku/nAvatar6.png)
Hi everyone,
I'm trying to fill empty cells on a database based on the value on another row but I am struggling a bit on this.
Basically I have a time based table where I have empty cells on some days. I would like to fill those cells with the value of the previous day when they happen to be empty (example below).
Input:
Date | Value |
2020-01-01 | 1 |
2020-01-02 | 2 |
2020-01-03 | |
2020-01-04 | 3 |
Output:
Date | Value |
2020-01-01 | 1 |
2020-01-02 | 2 |
2020-01-03 | 2 |
2020-01-04 | 3 |
I know in Excel a simple if + vlookup would do the trick but I can't find a solution on Dataiku...
As my project will be used by "non-coder" colleagues, I'd like to avoid the Python function method and stick to a visual recipe.
Thank you!
Best Answer
-
tgb417 Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS ML Practitioner, Dataiku DSS Core Concepts, Neuron 2020, Neuron, Registered, Dataiku Frontrunner Awards 2021 Finalist, Neuron 2021, Neuron 2022, Frontrunner 2022 Finalist, Frontrunner 2022 Winner, Dataiku Frontrunner Awards 2021 Participant, Frontrunner 2022 Participant, Neuron 2023 Posts: 1,598 Neuron
Welcome to the Dataiku community.
In the visual prepare recipes there is a step called fill down. Here is the documentationhttps://doc.dataiku.com/dss/latest/preparation/processors/up-down-fill.html
It looks like you might be doing some time series work. You may find the time series plugin to be of some help as well.
https://www.dataiku.com/product/plugins/timeseries-preparation/
let us all know how you are getting on with your project.
Answers
-
Thank you for your answer Tom!
I didn't think about the time series plugin. It will be helpful for the project!
-
tgb417 Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS ML Practitioner, Dataiku DSS Core Concepts, Neuron 2020, Neuron, Registered, Dataiku Frontrunner Awards 2021 Finalist, Neuron 2021, Neuron 2022, Frontrunner 2022 Finalist, Frontrunner 2022 Winner, Dataiku Frontrunner Awards 2021 Participant, Frontrunner 2022 Participant, Neuron 2023 Posts: 1,598 Neuron
If time series is your challenge, this Dataiku academy course might be just what you need for a detailed description on its use.
https://academy.dataiku.com/path/ml-practitioner/time-series-preparation-1