Skip to content
Discussion options

You must be logged in to vote

Good question — there are a few concrete reasons the current HTML-intermediate path was chosen over DataFrame.to_markdown() directly:

1. tabulate is not a mandatory dependency
DataFrame.to_markdown() requires tabulate to be installed. The HTML path only needs pandas (already required) plus BeautifulSoup (also already present for HTML conversion). Adding tabulate would either be a new hard dependency or require conditional logic.

2. The HTML path handles more Excel features
Excel sheets can contain merged cells, multi-level headers, mixed types, and formatted numbers. DataFrame.to_html() preserves some of these via colspan/rowspan attributes. to_markdown() flattens the DataFrame and loses …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@kirisame-wang
Comment options

Answer selected by kirisame-wang
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants