I liked the use of lag columns!
Hi!
My first participation. This is my solution without loops and using a date dimension table.
HL
Here’s my solution.
I took on the challenge on avoiding using loop. Besides a hairy loop in a Column Expression node, the only way I could come up with to calculate Network Days, was to use a Python-node, where numpy has a nice function ‘busday_count’. I didn’t use any custom packages and hence didn’t see a need for adding the Conda Environment Propagation node (of which I’m a fan).
cheers
Hi everyone,
Here is my solution.
No loop.
Used Java Snippet and code from (Calculate number of weekdays between two dates in Java - Stack Overflow)
Hi,
Here’s my solution to the JustKnimeIt Challenge 20. Wasn’t able to come up with a solution without Loops. Used some Nodes from a workflow I found on this thread: Calculating the number of working days between 2 dates in KNIME
This is an alternative solution, without loops, not even in the Column Expressions node. Actually, if you have the starting day of the week and the number of days in the period you can compute the “network days” with a single (quite ugly) Math Formula
Here is my solution. This one was harder and was a lot of fun. With a loop this would be pretty easy but without! I decided to go in on Java. I had a job years ago coding c# so it was fun to dig in. I created (OK, took some code from stack overflow) my own custom Java Network Days equivalent. I tested it against some excel generated data so I think it should be pretty solid.
My Submission for Challenge 20
- Miss the Loop - node in disguise
Wow, I love how diverse these answers are. Some use Java, some R, some Python, and some keep it all within KNIME. My own solution is purely KNIME no-code (not even column expression; should have made using pure KNIME a mega bonus challenge ).
Good night everyone,
here is my take on this challenge. With a bit of code in Python, I managed to manipulate the input table and calculate the business/network days between hospital visits.
This can also be done in pure KNIME, maybe using rules and date ranges, with no loops.
Yes, this one was hard. hehe Thanks for sharing your solution and experience with us!
@walkergv77 Thank you for sharing your solution. The logic that drives it is very elegant. In other words, I blatantly copied the code to make a 3 node Node Golf version with it.
It also allowed me to shave off 4 nodes from my pure-KNIME non-scripting version.
How it works:
- Groupwise-Multicolumn Lag to set up the data
- shift start and end dates away from weekends so we don’t have to bother with half weekends
- actual date difference
- subtract twice the number of weekends and do some corrections
- calculate mean
The smarter corrections in the middle branch can do without the weird start/end shifts.
Hello folks!
As always on Tuesdays, here’s our solution to last week’s challenge.
So much variety in the solutions this time around!
Very cool. Glad it could be useful! Will download and poke around in your workflow.
@Thyme I like what you did here. I’ll admit it’s been so long since I was a pure coder I didn’t necessarily understand the logic of what I was doing and was ‘borrowing’ script from SO. I procrastinated on actual (paying) work to solve the challenge so I had to put a hard cap on my time before I could figure out what I actually did. That’s why I tested against network days using Excel. Glad you could explain the DAYS.between() part. Appreciate that.