map_df = pd.DataFrame({'Keyword': ['NewWordsWithFriends',
    'com.fingerarts.sudoku'], 'Game': ['Words With Friends',
    'Sudoku by FingerArts']})
mapping = {vals[1]: vals[0] for vals in map_df.values}
regex = '|'.join([keyword.replace('.', '\\.') for keyword in map_df['Keyword']]
    )

def get_keyword(user_agent):
    matches = re.findall(regex, user_agent)
return matches[0] if len(matches) > 0 else np.nan
df['GameName'] = df['user-agent'].apply(get_keyword)
df['GameName'] = df['GameName'].map(mapping)
Python Pandas: Lookup table by searching for substring