Map a function over each row

You can apply a function to each row in a DataFrame using df.map(function).

Using the DataFrame

import pandas as pd

df = pd.DataFrame({'name': ['Jeff', 'Esha', 'Jia'], 
                   'age': [30, 56, 8]})
name age
1 Jeff 30
2 Esha 56
3 Jia 8

Write a function, add_name_reverse_name(df) that adds a new column, name_reverse_name to the DataFrame which is the concatenation of the person's name and the reverse of their name. For example, "Jeff" would be "JeffffeJ".

Example Input

Code to generate input

df = pd.DataFrame({'name': ['Jeff', 'Esha', 'Jia'], 
                   'age': [30, 56, 8]})


Table generated

name age
0 Jeff 30
1 Esha 56
2 Jia 8

Example Output

name age name_reverse_name
0 Jeff 30 JeffffeJ
1 Esha 56 EshaahsE
2 Jia 8 JiaaiJ