DataFrame.
to_markdown
Print DataFrame in Markdown-friendly format.
New in version 1.0.0.
Buffer to write to. If None, the output is returned as a string.
Mode in which file is opened, “wt” by default.
Add index (row) labels.
New in version 1.1.0.
Extra options that make sense for a particular storage connection, e.g. host, port, username, password, etc., if using a URL that will be parsed by fsspec, e.g., starting “s3://”, “gcs://”. An error will be raised if providing this argument with a non-fsspec URL. See the fsspec and backend storage implementation docs for the set of allowed keys and values.
fsspec
New in version 1.2.0.
These parameters will be passed to tabulate.
DataFrame in Markdown-friendly format.
Notes
Requires the tabulate package.
Examples
>>> s = pd.Series(["elk", "pig", "dog", "quetzal"], name="animal") >>> print(s.to_markdown()) | | animal | |---:|:---------| | 0 | elk | | 1 | pig | | 2 | dog | | 3 | quetzal |
Output markdown with a tabulate option.
>>> print(s.to_markdown(tablefmt="grid")) +----+----------+ | | animal | +====+==========+ | 0 | elk | +----+----------+ | 1 | pig | +----+----------+ | 2 | dog | +----+----------+ | 3 | quetzal | +----+----------+