I have a data in excel sheet like as below
Name Segment revenue Product_id Status Order_count days_ago
Dummy High value 1000 P_ABC Yes 2 30 days ago
Dummy High value 1000 P_CDE No 1 20 days ago
Dummy High value 1000 P_EFG Yes 3 10 days ago
Tammy Low value 50 P_ABC No 0 100 days ago
Tammy Low_value 50 P_DCF Yes 1 10 days ago
I would like to do the below steps in order
a) Concat the columns Product_id, Status, Order_count
into one column. Use -
symbol in between values
b) Group the data based on Name, Segment and revenue
c) Combine multiple rows for same group into one row (in excel).
I tried something like below
df['concat_value'] = df['Product_id'] + " - " + df['Status'] + " - " + df['Order_count']
df_group = df.groupby(['Name','Segment','revenue'])
df_nonrepeats = df[df_group['concat_value'].transform('count') == 1]
df_repeats = df[df_group['concat_value'].transform('count') > 1]
But am not able to get the expected output as shown below in the excel sheet.
Can you help me on how can I get the below output in excel sheet?