STUDY Teacher UPDATE_DATE COMPARE_DATE INTERVAL_DAYS
0 entertainment C 2022-03-02 2022-01-01 0.61
1 entertainment B, C 2022-03-02 2022-04-10 0.39
2 math A 2022-02-25 2022-01-01 0.56
3 math A, C 2022-02-25 2022-04-10 0.44
4 science D 2022-01-03 2022-01-01 0.02
5 science A 2022-01-03 2022-02-20 0.48
6 science A, B, E 2022-02-20 2022-04-10 0.49
7 technology E 2021-09-01 2022-09-01 0.00
Q. when there are more than 2 teacheres, I want to create a row by splitting based on "," and divide the value of the INTERVAL_DAYS field by the number of teachers to add. I thought it had a similar structure to the compare_date function you helped and tried to apply it, but the desired output did not come out, so I had to raise an additional question.
STUDY Teacher UPDATE_DATE COMPARE_DATE INTERVAL_DAYS
0 entertainment C 2022-03-02 2022-01-01 0.61
1 entertainment B 2022-03-02 2022-04-10 0.2
2 entertainment C 2022-03-02 2022-04-10 0.2
3 math A 2022-02-25 2022-01-01 0.56
4 math A 2022-02-25 2022-04-10 0.22
5 math C 2022-02-25 2022-04-10 0.22
6 science D 2022-01-03 2022-01-01 0.02
7 science A 2022-01-03 2022-02-20 0.48
8 science A 2022-02-20 2022-04-10 0.16
9 science B 2022-02-20 2022-04-10 0.16
10 science E 2022-02-20 2022-04-10 0.16 11 technology E 2021-09-01 2022-09-01 1.00
The final thing you want to get is the sum of interval days for each Teacher.
Teacher WORKING_COUNTS
0 A 2
1 B 0.36
2 C 1.03
3 D 0.02
4 E 1.16