I have a table with the following structure; the count
column gets updated every time a user accesses the app again on that date.
user_id | date | count |
---|---|---|
1 | 1/1/2021 | 4 |
2 | 1/1/2021 | 7 |
1 | 1/2/2021 | 3 |
3 | 1/2/2021 | 10 |
2 | 1/3/2021 | 4 |
4 | 1/1/2021 | 12 |
I want to de-aggregate this data based on the count
, so for example, user_id
of 1 will have four records on 1/1/2021 without the count
column. After that, I want to concatenate a random time to the date. My output would like this:
user_id | date_time |
---|---|
1 | 1/1/2021 16:00:21 |
1 | 1/1/2021 7:23:55 |
1 | 1/1/2021 12:01:45 |
1 | 1/1/2021 21:21:07 |
I'm using pandas for this. Randomizing the timestamps is straightforward I think, just de-aggregating the data based on a column is a little tricky for me.