I'm sure this would be a common question, however yet to find an answer for.
Suppose I have two, 2D vectors in Python
RaceA =[[ Runner ID, Heart Rate, Kilometers Done,],
[1234, 67, 50],
[1256, 83,64],
[1356,92,82],
[845,80,18]]
RaceB =[[ Runner ID, Heart Rate, Kilometers Done,],
[845, 79, 74],
[5363, 86,34],
[1256,84,53],
[12233,93,74],
[4233,40,34]]
As you can see, both races had different racers. I'd like to compare the heart rates of racers who ran both of the races.
Hence my answer would be:
[[Racer ID, Heart Rate A, Heart Rate B],
[1256,83,84],
[845,80,79]]
I've used the '&' operator and that returns me the racers IDs for example. But I feel like I'm missing out on a function that will return me heart rate values for both racers in a swift fashion.
This obviously isn't my problem (I have vectors 6000 and 50000 rows long) but the premise is there.
pandas
, then theix
method along with the&
should solve this for you. $\endgroup$ – gpavanb Jul 24 '17 at 19:13