Reputation: 1449
I am trying to filter a Pandas pivot table based on a Pandas dataframe. For example:
df1
test_id gene
ENSMUSG00000000001.4 Gnai7
ENSMUSG00000000003.15 Pbsa
ENSMUSG00000000028.14 Cdc4
pt1
condition CAS CAS CAS
replicate 0 1 2
tracking_id
ENSMUSG00000000001.4 45.25 46.55 49.88
ENSMUSG00000000028.14 1.51 1.63 1.62
ENSMUSG00000000031.15 16.99 17.54 18.69
output
condition CAS CAS CAS gene
replicate 0 1 2
tracking_id
ENSMUSG00000000001.4 45.25 46.55 49.88 Gnai7
ENSMUSG00000000028.14 1.51 1.63 1.62 Cdc4
The merge method seems like a potential solution by using the test_id
and tracking_id
as keys. Although I'm not sure how to also include the gene
column in the output too.
Thank you :)
Upvotes: 2
Views: 201