I have following pandas data frame that I have build:
dark Mystery adult crime action comedy cartoon winter snow skiing
0001 0.00 0.000 0.000 0.00 0.00 0.000 0.00 0.56 0.65 0.789
0004 0.89 0.678 -0.423 0.12 0.00 0.000 0.00 0.00 0.00 0.000
0005 0.00 0.000 0.000 0.00 0.12 0.678 -0.89 0.00 0.00 0.000
I also have a list that has some of the row index values of the data frame. After filtering I want to have my new data frame with indexes matching the values in the list.
l = [001,005]
This is large data frame I am trying to figure out without iterating via loop.
[df.index[idx] for idx in l]
This is wrong but I feel I am close to the answer or may be not.
Result should be:
dark Mystery adult crime action comedy cartoon winter snow skiing
0001 0.00 0.000 0.000 0.00 0.00 0.000 0.00 0.56 0.65 0.789
0005 0.00 0.000 0.000 0.00 0.12 0.678 -0.89 0.00 0.00 0.000