I would like to create a unique_id for each line in my dataframe, basing it on the date.
df1:
+---+-----+----+-------+-----+
|day|month|year| userid|units|
+---+-----+------------+-----+
| 01| 01|2016|87cb11 | 0|
| 01| 01|2016|87cb11 | 1|
| 01| 01|2016|87cb11 | 2|
| 02| 01|2016|87cb11 | 0|
| 02| 01|2016|87cb11 | 1|
| 02| 01|2016|87cb11 | 2|
+---+-----+----+-------+-----+
I have tried to use monotonically_increasing_id()
but I am unsure of how to create an increasing number which will have a certin lenght.
df2:
+---+-----+----+-------+-----+---------------+
|day|month|year| userid|units| unique_id |
+---+-----+------------+-----+---------------+
| 01| 01|2016|87cb11 | 0|201601010000001|
| 01| 01|2016|87cb11 | 1|201601010000002|
| 01| 01|2016|87cb11 | 2|201601010000003|
| 02| 01|2016|87cb11 | 0|201601020000001|
| 02| 01|2016|87cb11 | 1|201601020000002|
| 02| 01|2016|87cb11 | 2|201601020000003|
+---+-----+----+-------+-----+---------------+