Modify a column

Similar to adding a column, you can replace an existing column by using the same column syntax (df[column] = value_for_each_row) but with column equal to an existing column name.

Using the same DataFrame shape from the previous exercise,

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, age_in_days(df) which takes in the DataFrame and returns a new DataFrame with the column age modified to be in terms of days instead of years.

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

age
0 10950
1 20440
2 2920