AttributeError: 'DataFrame' object has no attribute 'rename'

PHorniak
New Contributor II

Hello, I am doing the Data Science and Machine Learning course.

The Boston housing has unintuitive column names. I want to rename them, e.g. so 'zn' becomes 'Zoning'.

When I run this command:

df_bostonLegible = df_boston.rename({'zn':'Zoning'}, axis='columns')

Then I get the error "AttributeError: 'DataFrame' object has no attribute 'rename'".

I did a websearch and found a few guides that were inapplicable:

https://stackoverflow.com/questions/28163439/attributeerror-dataframe-object-has-no-attribute-height...

https://stackoverflow.com/questions/38134643/data-frame-object-has-no-attribute