I have this dataframe.
+-----+--------+--------------------------------+
|ID |Date |Text |
+-----+--------+--------------------------------+
|1 |1 Jan |This is a text |
|2 |2 Jan |Text can be of variant length |
+-----+--------+--------------------------------+
How can i split and pivot the Text column to the ID and Date?
+-----+--------+-------+
|ID |Date |Text |
+-----+--------+-------+
|1 |1 Jan |This |
|1 |1 Jan |is |
|1 |1 Jan |a |
|1 |1 Jan |text |
|2 |2 Jan |Text |
|2 |2 Jan |can |
|2 |2 Jan |be |
|2 |2 Jan |of |
|2 |2 Jan |variant|
|2 |2 Jan |length |
+-----+--------+-------+
I know that for pivot, I can use df.stack()
but i am having trouble with splitting it due to the difference in length for each text.
I would really appreciate any help.