I am new to Python. I am trying to add a randomly generated variable to an already existing dataframe. I get an error message, but can't figure out why.
import pandas as pd
import numpy as np
data=[10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
df=pd.DataFrame(data, columns=['age'])
# Add income:
income_5 = np.random.randint(low=0, high=4, size=(nrows(df,))+1
df['income5'] = income_5
What am I doing wrong?