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

INSTALLED VERSIONS ------------------ commit : 2e218d10984e9919f0296931d92ea851c6a6faf5 python : 3.10.10.final.0 python-bits : 64 OS : Darwin OS-release : 21.6.0 Version : Darwin Kernel Version 21.6.0: Mon Dec 19 20:44:01 PST 2022; root:xnu-8020.240.18~2/RELEASE_X86_64 machine : x86_64 processor : i386 byteorder : little LC_ALL : None LANG : None LOCALE : fr_FR.UTF-8 pandas : 1.5.3 numpy : 1.24.1 pytz : 2022.7.1 dateutil : 2.8.2 setuptools : 67.2.0 pip : 23.0 Cython : None pytest : None hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : 4.7.1 html5lib : None pymysql : None psycopg2 : None jinja2 : 3.1.2 IPython : 8.7.0 pandas_datareader: None bs4 : 4.11.1 bottleneck : None brotli : None fastparquet : None fsspec : None gcsfs : None matplotlib : 3.5.2 numba : None numexpr : None odfpy : None openpyxl : 3.0.9 pandas_gbq : None pyarrow : None pyreadstat : None pyxlsb : None s3fs : None scipy : None snappy : None sqlalchemy : 1.4.46 tables : None tabulate : 0.8.9 xarray : 2022.3.0 xlrd : None xlwt : None zstandard : None tzdata : None

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