Here's a very truncated extract from a large dataframe:
| name | age | city |
|---|---|---|
| ben | 66 | NY |
| rob | 45 | LON |
| james | 22 | LA |
I also have a numerous strings that each contain different words but will contain one (not more) of the values in the name column.
For example:
- "rob was born in London"
- "ben once lived in New York"
For each string I want to iterate over the "name" column to find the name that matches the name in the string and return the age of the person.
So in the first example the desired result is 45 and in the second example the desired result is 66.
I am new to Pandas and am struggling. Can anyone point me in the right direction?