Source Code:
(back to article)
import pandas as pd # Erstelle einen Beispiel-DataFrame df = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6]}) # Methode 1: mit .rename_axis() df = df.rename_axis("Index", axis=0) # Methode 2: mit .index.name df.index.name = "Index" print(df)
Result:
Report an issue