0

I am trying to create a new column by combing the data from two Pandas DataFrames (DF1 and DF2). I would like to use this combined data to create a new column ("Win %") in a new DataFrame (DF3). The catch is I would like to extract only the relevant data that I am looking for. I am not sure if I need something similar to Vlookup.

I will create an example to show you what I am trying to do. Let's say I want to bet on a fighter that I think will win a tournament.

I have some fight data in DF1. The data in DF2 will also add more value so I would like to include this info as well. Ultimately I would like to create a new column in DF3 called "Win %".

Attention: I would only like DF3 to include the names from DF1 and their corresponding info.

DF1 (located below)

Name                      Age    Weight   Height

Chuck Norris              35       154     5'10
Bruce Lee                 30       128     5'8"
Jean Claude Van Damme     20       185     5'10"

DF2 (located below)

Name                    Win %

Rocky Balboa             .75
Arnold Schwarzenegger    .85
Bruce Lee                .99
Steven Seagal            .65
Chuck Norris             .98
Jean Claude Van Damme    .25

I would like the final output for DF3 to include:

1) only the names and data of the fighters in DF1 (Chuck Norris, Bruce Lee, Jean Claude Van Damme)

2) the data "Win %" from DF2 corresponding to the correct fighter.

DF3 (located below)

Name                      Age    Weight   Height   Win % (Win % is the new column added)

Chuck Norris              35       154     5'10     .98 (new data)
Bruce Lee                 30       128     5'8"     .99 (new data)
Jean Claude Van Damme     20       185     5'10"    .25 (new data)

As you can see DF3 includes the name and relevant data of the 3 fighters from DF1 and the Win % from DF2. Any help would be greatly appreciated. Thank you in advance for any info that you many offer.

Able Archer
  • 421
  • 4
  • 13

0 Answers0