Thinking about the best way to merge two DataFrame
If you are trying to get the city part of a NHL team name, you could for example:
Make a hash map which contains all the possible city names; {"Toronto": "Toronto"},
split the NHL TEAM string and check if the hash map contains any part of the string. If it does that's the city name.
With the limited amount of possible city names that's not too bad.
But I'm not exactly sure what you are trying to accomplish, you should elaborate and simplify your question.
I'm looking for a way to merge df. However, I don't know what would be the best way to do this.
first df - metro cities/population/teams




Metropolitan area
Population (2016 est.)[8]
NHL




Phoenix
4661537
Coyotes


Los Angeles
13310447
Kings Ducks


Toronto
5928040
Maple Leafs


Boston
4794447
Bruins


Edmonton
1321426
Oilers


New York City
20153634
Rangers Islanders Devils




Second df - team/wins/losses




team
w
L




Los Angeles Kings
46
28


Phoenix Coyotes
37
30


Toronto Maple Leafs
49
26


Boston Bruins
50
20


Edmonton Oilers
29
44


New York Islanders
34
37




I tried to merge across teams. However, I need to arrange this data so that it collides in the Merge. I don't know how I would do that without looking at it case by case.
Note: The data set is much larger and with more cities and teams.
I had a little trouble presenting the DF here, so I only put 6 rows and the main columns.