I have a dataFrame that looks like this
Bag Blush Nail Polish Brushes Concealer Eyebrow Pencils Bronzer Lip liner
0 0 1 1 0 1 0 0 1 1
1 0 0 1 1 0 1 0 0 1
that contains 1000 entries which show transaction data. If the person bought the item it is 1 and if they did not buy it is 0. I am using the Manhattan norm as the 'distance' between each transaction. I created my function as
#Using the Manhattan norm
def Mn(v):
return sum(v)
manhattan_norm=lambda x,y: Mn((x-y)%2)
I am trying to apply this function to the dataframe to get an output that shows the distance between the transactions. I was able to do it when I assigned row 1 and 2 by x and y but can not get it to work through the whole dataframe row by row. Thank you for any help.