I cannot figure out how to ask this question in a searchable way, but I feel that this is a simple question.
Given a pandas Dataframe object, I would like to use one column as an index, one column as columns and a third column as values.
For instance:
abc 0 1 dog 2 1 1 cat 1 2 1 rat 6 3 2 cat 2 4 3 dog 1 5 3 cat 4
I would like the custom column βaβ to be both my index values, column βbβ as my columns, and column βcβ as values ββfor each row / column, and fill 0 for missing values ββ(if possible) . For instance...
dog cat rat 1 2 1 6 2 0 2 0 3 1 4 0
This would be the matrix 'a' by 'b' with 'c' as fill values
source share