Insert missing dates range

There is a challenge when I am dealing with date format information. It would be highly appreciated if anyone can show me a way to solve this challenge.
Challenge description

  1. The original date format is not continually in days, namely the column of date is showed as these 2 columns: start date:22-01-01, End date: 2022-9-17
  2. My target is that: can I insert the missed date range rows e.g. Start date" 2022-09-18, End date: 2022-12-31, is there any node in Knime platform that can automatically find the gap range and then insert the missing date range of the whole calendar year.


Thank you in advance!

@kellyhui welcome to the KNIME forum. What would be the rules how to determine which dates to fill.

Maybe you can provide us with sample data that demonstrate what you want to do.

1 Like

Thanks for replying.

For example, I have these data, for these 2 people:

Some periods of the whole 2022 calendar year are missing.
I want write a KNIME flow that automaticly add the missing periods rows, like this:(the red 2 rows are the new added missing periods).

I only found solutions for adding missing dates so far using “Ctreat Date&Tiime Range” node. However my situation is adding missing periods.

Thanks a lot!

@kellyhui well, how would we know what kind of periods are missing, how long they should be and what would constitute such a period?

1 Like

Just consider 2022-01-01 to 2022-12-31 as the whole calendar year.

If one person’s periods don’t consititute to the whole year (2022-01-01 to 2022-12-31), then add missing periods accordingly at the right positions. For example:


We add additional one row for the missing days between 2022-09-18 to 2022-09-19. The new row should be after the first row and before the third row, so the whole periods in 2022 for this person are continuously.

@kellyhui OK I do understand, do you have a dataset that you can upload? Also I understand there can be more then one missing row. Will there be several years or just one?

Test file.xlsx (9.7 KB)

Yes, this is the test file and you are correct that there can be more than one missing row.

I am only analyzing one year’s data, so only 2022.

Thank you very much for your prompt reply and help, I really appreciate it!

@kellyhui late and lazy I just let ChatGPT write some Python code. Is it correct that only two lines had to be inserted in your case?

Maybe you can check this out. Might add something more knime like later.

kn_forum_72565_python_missing_date_pairs.knwf (37.1 KB)


Thank you so much about this python extension help. It worked!
As I am a totally beginner, I don’t know understand the first line of code “import as knio”? Is this loading the data I have? and where can I find the name of this input file?

Can I also please ask you one additional question after adding these 2 missing rows?
I have other columns for each person except start date and end date. For the new adding row, I want to copy other columns from the last period for this person. For example:(the red column is the new added row and other columns of this new row are the copies from the row before). I updated new excel input file with 2 other columns.


It would be great if you can share your KNIME Python Script code and give me some hints about how to search chatgpt wisely to get the code I want. :hugs:
Test file.xlsx (10.3 KB)

Thank you again.

@kellyhui you can read about python and knime and the use of ChatGPT in the two articles I linked.

The import … would activate the KNIME python module called “knio”. This is how Python handles its modules. From my perspective it will make much sense to learn just enough python to use such small snippets to extend one’s abilities.

You can load the full example from the entry or the KNIME hub and try yourself. You can import the .knar file in your own knime version.

If you want to fill columns with values from above you can usev the missing value node:

1 Like

Good morning, thanks a lot really. I will try these today.
Have a nice day. :grinning:

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.