Blockquote
I have the following data frame:
uniquie_id gsett start end catpri rep
0 000001_01 2 1900-01-01 04:00:00 1900-01-01 07:50:00 1 23
1 000001_01 2 1900-01-01 07:50:00 1900-01-01 08:00:00 2 1
2 000001_01 2 1900-01-01 08:00:00 1900-01-01 08:10:00 3 1
3 000001_01 2 1900-01-01 08:10:00 1900-01-01 08:30:00 4 2
4 000001_01 2 1900-01-01 08:30:00 1900-01-01 09:50:00 5 8
5 000001_01 2 1900-01-01 09:50:00 1900-01-01 10:00:00 2 1
6 000001_01 2 1900-01-01 10:00:00 1900-01-01 11:50:00 6 11
7 000001_01 2 1900-01-01 11:50:00 1900-01-01 12:00:00 4 1
8 000001_01 2 1900-01-01 12:00:00 1900-01-01 13:50:00 4 11
9 000001_01 2 1900-01-01 13:50:00 1900-01-01 14:50:00 7 6
10 000001_01 2 1900-01-01 14:50:00 1900-01-01 15:50:00 8 6
11 000001_01 2 1900-01-01 15:50:00 1900-01-01 16:00:00 3 1
12 000001_01 2 1900-01-01 16:00:00 1900-01-01 16:50:00 3 5
13 000001_01 2 1900-01-01 16:50:00 1900-01-01 17:50:00 3 6
14 000001_01 2 1900-01-01 17:50:00 1900-01-01 18:00:00 9 1
15 000001_01 2 1900-01-01 18:00:00 1900-01-01 18:40:00 5 4
16 000001_01 2 1900-01-01 18:40:00 1900-01-01 18:50:00 9 1
17 000001_01 2 1900-01-01 18:50:00 1900-01-01 20:50:00 4 12
18 000001_01 2 1900-01-01 20:50:00 1900-01-01 21:20:00 7 3
19 000001_01 2 1900-01-01 21:20:00 1900-01-01 21:30:00 8 1
20 000001_01 2 1900-01-01 21:30:00 1900-01-01 21:50:00 8 2
21 000001_01 2 1900-01-01 21:50:00 1900-01-01 22:00:00 10 1
22 000001_01 2 1900-01-01 22:00:00 1900-01-02 00:50:00 10 17
23 000001_01 2 1900-01-01 00:50:00 1900-01-02 04:00:00 13 19
There are more the 1000000 I need to make a data frame that in each row I have unique_id as columns date from 1900-01-01 04:00
to 1900-01-02 04:00:00
with 10 minutes interval. The values to be put in each row/colums are the catpri
values.
It should look somthing like this:
1900-01-01 04:00:00 1900-01-01 04:10:00 ... 1900-01-02 03:50:00 1900-01-02 04:00:00
000001_01 1 1 ... 13 13
I have tried to wirte a function and use apply
but it still take ages.
Any suggestion how to do this quikly?