Data Cleaning Exercise

Screen Link: https://app.dataquest.io/m/293/data-cleaning-basics/3/cleaning-column-names-continued

My Code:

for elements in laptops.columns :
                    elements = (clean_col(elements))

What I expected to happen: The same result of - new_columns =

for c in laptops.columns:
    clean_c = clean_col(c)
    new_columns.append(clean_c)
    
laptops.columns = new_columns

What actually happened: Error

Replace this line with the output/error

Hi @keswani06! I hope you are doing well.

Probably the main error is due to the fact that you’re using the name ‘elements’ as the function’s parameter and also calling it as a variable. Trying doing something like this (you can call the variable as you wish):

for elements in laptops.columns:
        clean_elements = clean_col(elements)
        new_columns.append(cleam_elements)

Just let me know if my explanation worked for you, ok? And if so, please check my answer as solution. I’d appreciate a lot :grinning: