Python3, column names from array - numpy or pandas

renjith madhavan renjithmadhavan at gmail.com
Thu Dec 15 08:56:41 EST 2016


Thank you for the reply. 
I tried that, I am trying to do this.

The context is I am trying to find mapk ( k = 3 ) for this list.
A, B , C, D and E are product names.

If I am trying manually I will do something like this.

TRUTH = [[A], [B,C], [A], [D,E]]
and if my prediction is :
PRED=[[B,A, D], [A,C,B], [A,B,C], [B,D,E]]

map3(truth, pred, 3)

 
How do I convert my input truth values in the TRUTH format.
Should I be looking for "boolean indexing" for this case.
id        A        B        C        D        E 
    100        1        0        0        0        0 
    101        0        1        1        0        0 
    102        1        0        0        0        0 
    103        0        0        0        1        1 
    ''') 


More information about the Python-list mailing list