Guided Project: Creating a Kaggle Workflow

I made this line of codes below:
dummies_cols = [‘Age_categories’, ‘Fare_categories’, ‘Title’,
‘Cabin_type’, ‘Sex’]
for item in [train, holdout]:
item = process_missing(item)
item = process_age(item)
item = process_fare(item)
item = process_titles(item)
item = process_cabin(item)
for col in dummies_cols:
item = create_dummies(item, col)

Comparing it to the solution below:
def pre_process(df):
df = process_missing(df)
df = process_age(df)
df = process_fare(df)
df = process_titles(df)
df = process_cabin(df)

for col in ["Age_categories","Fare_categories",
            "Title","Cabin_type","Sex"]:
    df = create_dummies(df,col)

return df

train = pre_process(train)
holdout = pre_process(holdout)

The problem was that my coding didn’t return the dummy columns. What is wrong with my code and the difference from the solution?

  • indent of my codes is correct, just posting here didn’t have indent