I have a dataframe of multiple columns and thousands of rows where one of the columns (called Customers) contains list of customer Ids:
| Customers |
|---------------------|
|[A, B, C, D, E, F, G]|
|[A, C, D, E, F, G] |
|[A, C, E, G] |
|[G] |
I am interested to find the element differences between each row and its previous row for the Customers column, so my expected outcome should be:
|Customer Difference |
|---------------------|
|[] |
|[B] |
|[D, F] |
|[A, C, E] |
The Customer column is sorted meaning every row will contain all elements of its below row
I know I can use sets to find two list difference but not sure what would be a pythonic way to do this on the entire column.
Thanks