Data Cleaning Exercise

Screen Link:

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)
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)

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: