I have a column in a dataframe which contains list data
for example:
enter code here
| Column 1 | Column 2 |
|--------- |---------------------------|
| 1 | ['jan'] |
| 2 | ['jan','feb'] |
| 3 | ['feb','jan'] |
| 4 | ['mar','april','jan'] |
| 5 | ['jan','mar','april'] |
| 6 | ['jan','feb','mar'] |
| 7 | ['jan','feb','mar'] |
As in the above table we can see column 2, row 2 and row 3 have same list with different order. same is the case with other values too. like (row 4 and row 5)
I have to sort in this order
enter code here ['oct' ,'nov' ,'dec' ,'jan' ,'feb' ,'march' ,'april']
The desired output should be like below, a new column 3 with sorted values
enter code here
| Column 1 | Column 2 | Column 3 |
|--------- |---------------------------|---------------------------|
| 1 | ['oct'] | ['oct'] |
| 2 | ['oct','nov'] | ['oct','nov'] |
| 3 | ['nov','oct'] | ['oct','nov'] |
| 4 | ['mar','april','jan'] | ['jan','mar','april'] |
| 5 | ['jan','mar','april'] | ['jan','mar','april'] |
| 6 | ['jan','feb','mar'] | ['jan','feb','mar'] |
| 7 | ['jan','feb','mar'] | ['jan','feb','mar'] |