W3docs

Pandas index column title or name

To set the name of the index column in a pandas DataFrame, you can use the .rename_axis() method or the .index.name attribute.

To set the name of the index column in a pandas DataFrame, you can use the .rename_axis() method or the .index.name attribute. Here is an example:

set the name of the index column in a pandas DataFrame

python— editable, runs on the server
Info

Watch a video course: Python - The Practical Guide

This will set the name of the index column to "Index". You can replace "Index" with any other string to set the desired name.