Data cleaning with Pandas mission 2

Any help on this?

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

My Code: <``````>

new_columns=[]
for column in laptops.columns:
    str.strip(column)
    new_columns.append(column)
laptops.columns = new_columns

What I expected to happen:

What actually happened:

I honestly can’t figure out why it gives me an actual vs. expected error. I feel very silly.

The problem is that you are appending the same value. I mean, your str.strip(column) is doing it’s work but it doesn’t have any place to save it so you need to create a variable first to be able to append that value to new_columns.

Or maybe you can do it in one line new_columns.append(str.strip(column))

2 Likes

I’m an idiot. Thanks.