When I rename my dataframe's index column it doesn't print on o the same line as my column headings. How do I fix this so the Index colum heading prints on the same row as the other column headings?
Asked
Active
Viewed 30 times
0

Dan
- 13
- 4
-
Does this answer your question? [Remove index name in pandas](https://stackoverflow.com/questions/29765548/remove-index-name-in-pandas) – ouroboros1 Aug 22 '23 at 06:47
-
You could try print(df.to_markdown()) – user16164298 Aug 22 '23 at 10:40
1 Answers
1
Assuming you merely want to adjust, how the DataFrame is printed in the console, this seems to not be possible. Pandas offers several possibilities to adjust how values are displayed by default: pandas options
However, the placement of the index header seems to not be included here. Obviously, if you intend to export the DataFrame in a text file, website, or anything else - there are several possibilites to adjust the styling.

xArbisRox
- 91
- 5