question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add index=False option to_markdown()

See original GitHub issue

Problem description

This is a feature request to add an optional index=False argument to the new to_markdown() dataframe method. This would produce a markdown table without the initial unnamed index column.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:7
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

7reactions
dsaxtoncommented, Mar 12, 2020

This is actually possible by passing showindex=False, but could probably be better documented (it’s one of the tabulate kwargs):

In [1]: import pandas as pd       
                                                                                                                                                                                                        
In [2]: df = pd.DataFrame({"a": [1, 2, 3]})              
                                                                                                                                                                                 
In [3]: print(df.to_markdown(showindex=False))                                                                                                                                                                                            
|   a |
|----:|
|   1 |
|   2 |
|   3 |
1reaction
chrisjcameroncommented, Mar 27, 2020

What should the behaviour be if user set both showindex and index? Which one should take the priority or should I raise an ValueError

I think most users will be expecting pandas-like keywords to work, so I would prioritize those. An alternative might be a warning about “When both index and showindex are set, one value will be used but which is undefined”. This would at least give users a clue that these need not both be specified but gives a lot of latitude for future refinement that changes the behavior.

Read more comments on GitHub >

github_iconTop Results From Across the Web

pandas.DataFrame.to_markdown
Print DataFrame in Markdown-friendly format. ... Add index (row) labels. ... Extra options that make sense for a particular storage connection, e.g. host, ......
Read more >
Markdown to create pages and table of contents?
And to generate the TOC, open the command palette ( Control/⌘ + Shift + P ) and select the Select Markdown: Create Table...
Read more >
3.1 HTML document | R Markdown: The Definitive Guide
To create an HTML document from R Markdown, you specify the html_document output format in the YAML metadata of your document:.
Read more >
setOptions - Marked Documentation
Options ; breaks, boolean, false, v0.2.7, If true, add <br> on a single line break (copies GitHub behavior on comments, but not on...
Read more >
Setting up site search - Material for MkDocs - GitHub Pages
Default: automatically set – The separator for indexing and query ... 8.0.0 · Default: false – MkDocs can generate a prebuilt index of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found