Setting and renaming columns and indices#
Learning Objectives#
After working through this topic, you should be able to:
Explain why the index is important
Rename columns in a DataFrame
Set single and MultiIndices
Materials#
Video:
Download the slides.
Quiz#
Using a meaningful index...
What will the output of the following code be?
>>> df.columns
Index(['a', 'b', 'c'], dtype='string')
>>> df = df.rename(columns={"b": "B", "x": "u"})
>>> df.columns