Input format:
CUSTOMER MONTH ISSUE
1 M1 ABC
1 M1 DEF
1 M2 ABC
1 M3 QRS
2 M1 PQR
2 M2 PQR
2 M2 ABC
2 M3 DEF
Desired output format:
CUSTOMER M1 M2 M3
1 ABC ABC QRS
1 DEF ABC QRS
2 PQR PQR DEF
2 PQR ABC DEF
I want to find out the possible distinct combinations at customer level and eventually sum of to get a count of such patterns across customers.
I can achieve the above using SQL joins on the same table, but the data is very huge & the number of combinations is very high. So it isn't efficient.
Pivot in Python & SQL wouldn't consider these duplicates. Is there any other solution I could try?
Thank you
I can achieve the above using SQL joins on the same table, but the data is very huge & the number of combinations is very high. So it isn't efficient.
Pivot in Python & SQL wouldn't consider these duplicates. Pivot error in Python: ValueError: Index contains duplicate entries, cannot reshape
In python you can achieve it using underneath segment a sample. You need to pass your data to the dataframe and will need to tweek the pivot rows and groupby column
Output:
To get complete list of combination
Output for above: