Pandas version checks
-
[X] I have checked that this issue has not already been reported.
-
[X] I have confirmed this bug exists on the latest version of pandas.
-
[X] I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
import pandas
df = pandas.DataFrame([[1,2],[3,4]],columns=['a','b'])
df.columns.name = 'some name'
print(df.to_markdown())
# prints
# | | a | b |
# |---:|----:|----:|
# | 0 | 1 | 2 |
# | 1 | 3 | 4 |
Issue Description
'some name' doesn't appear in top left corner | | a | b | |---:|----:|----:| | 0 | 1 | 2 | | 1 | 3 | 4 |
Expected Behavior
should print
some_name | a | b |
---|---|---|
0 | 1 | 2 |
1 | 3 | 4 |
Installed Versions
Comment From: MarcoGorelli
thanks @LeG2 for the report - could you please check if this happens when calling tabulate
directly, and if so, report this to tabulate
?
Comment From: MarcoGorelli
ok just checked and tabulate doesn't show the columns' name:
In [8]: print(tabulate(df, tablefmt='pipe', headers='keys'))
| | a | b |
|---:|----:|----:|
| 0 | 1 | 2 |
| 1 | 3 | 4 |
I'd suggest reporting there then
Comment From: jgarba
Take
Comment From: mroeschke
Since it appears that this is an upstream issue in tabulate, closing as an upstream issue
Comment From: LeG2
Thanks. Reported this as a tabulate issue : https://github.com/astanin/python-tabulate/issues/259