Skip to content

Commit 194f7d2

Browse files
Marco GorelliMarcoGorelli
authored andcommitted
✨ add **kwargs to DataFrame.to_markdown
1 parent e722ce1 commit 194f7d2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pandas/core/frame.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1986,7 +1986,11 @@ def to_markdown(self, **kwargs):
19861986
| 1 | 2 | 4 |
19871987
"""
19881988
tabulate = import_optional_dependency("tabulate")
1989-
return tabulate.tabulate(self, headers="keys", tablefmt="pipe", **kwargs)
1989+
if "headers" not in kwargs:
1990+
kwargs["headers"] = "keys"
1991+
if "tablefmt" not in kwargs:
1992+
kwargs["tablefmt"] = "pipe"
1993+
return tabulate.tabulate(self, **kwargs)
19901994

19911995
@deprecate_kwarg(old_arg_name="fname", new_arg_name="path")
19921996
def to_parquet(

0 commit comments

Comments
 (0)