newbie trying to learn from the best!
Started with my raw dataframe df:
df = ['Id' (can appear multiple times),'Reference', 'Error note']
Created another df to isolate the unique IDs:
supplier_list = df["ID"]
supplier_list = supplier_list.drop_duplicates(subset=['ID'])
Now, I want to add 2 columns to my supplier_list called "Total Orders","Number of mistaken orders" and "Number of succesfull orders". In df, Error Note can take 3 values, 'NC' = No Problem, 'Problem A', 'Problem B'.
In order to get the data I did as follows:
error_detail = df.value_counts(["ID", "Error note"]) #Gives me the frequency of each Error Note values for each ID.
Now, I would like to add this set of values to my main df as two new columns.
Thank you for your time!