So I have the data like below:
df = pd.DataFrame({'Customer':'Alan John Mike'.split(' ') * 3,
'Price':[111,222,333,444,444,222,666,111,333]})
I want to count the unique matching Price
across the customers
in 2 * 2 matrix and want the output like below:
I have the pivot function below but it returns just a count across matching Customers:
pvt = pd.pivot_table(df,index=['Customer'],columns=['Customer'], aggfunc={'Price':lambda x: x.nunique()})