Reputation: 2723
I have a table of 0's and 1's generated from pd.crosstab()
A row is a recipe and the columns are ingredients. So for example we can have:
banana mushrooms ... chocolate tuna
banana-split 1 0 ... 1 0
I'd like to transform it to a table where the columns and rows are both the ingredients and T[i,j]
= #number of recipes that has both ingredients, i
and j
In our example, T[banana, chocolate] = 1
and T[banana, tuna] = 0
How to do that?
Upvotes: 0
Views: 117