-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Add index=False option to_markdown() #32667
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This is actually possible by passing 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 | |
TBH I'm not sure it's worth documenting @chrisjcameron are you interested in submitting a PR? If so, see the contributing guide for how to get started |
adding index=False here would be ok (and translating to tabulate) PR welcome |
take |
What should the behaviour be if user set both |
Does it make sense to add the index parameter if the showindex parameter already exists and will be used in the same way? |
It would be more consistent with the other pandas |
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. |
thumbs up for this enhancement to the docs. l landed here looking exactly for that Lines 1996 to 2024 in 3adf334
|
Problem description
This is a feature request to add an optional
index=False
argument to the newto_markdown()
dataframe method. This would produce a markdown table without the initial unnamed index column.The text was updated successfully, but these errors were encountered: