How to create new column in a df based on multiple conditions?

I have two columns and would like to create a third. The logic that I am trying to create is;
Column A represents a unique customer record. For every unique customer based on email or ID number in column A I would like to look at column B and if there is a mix of POS and Web then the third column = MC, if not then non MC.


Column A Column B Column C POS POS WEB MC POS not MC
123456 POS
123456 WEB MC
123458 WEB not MC
Last edited:


Less is more. Stay pure. Stay poor.
Can you better provide an example of what data looks like and what you are trying to achieve and distinguish which is which?

sorry- so the example is attached.

Basically for every unique ID in the Customer column if the customer has purchased in both Channels; POS and web, they are Mcstatus = MC, and if they only purchase in the one channel then they are non MC.

I;ve filled out with the Mcstatus column with example data.

The final step would be to do a distinct count of the customer column to see how many total MC and non MC customers there are. :tup:

Let me know if anything needs clarifying further.

thanks a lot for your help.