Skip to main content
`Ctrl`+`K`

# pandas.Series.to_markdown

Series.to_markdown(buf=None, *, mode='wt', index=True, storage_options=None, **kwargs)

  Print Series in Markdown-friendly format.

  Converts the Series to a Markdown table representation using the tabulate package. The output can be written to a buffer or returned as a string.

  Parameters:
    buf str, Path or StringIO-like, optional, default None

      Buffer to write to. If None, the output is returned as a string.

    mode str, optional

      Mode in which file is opened, “wt” by default.

    index bool, optional, default True

      Add index (row) labels.

    storage_options dict, optional

      Extra options that make sense for a particular storage connection, e.g. host, port, username, password, etc. For HTTP(S) URLs the key-value pairs are forwarded to `urllib.request.Request` as header options. For other URLs (e.g. starting with “s3://”, and “gcs://”) the key-value pairs are forwarded to `fsspec.open`. Please see `fsspec` and `urllib` for more details, and for more examples on storage options refer here.

    **kwargs

      These parameters will be passed to tabulate.

  Returns:
    str

      Series in Markdown-friendly format.

  See also

  `Series.to_frame`

    Rrite a text representation of object to the system clipboard.

  `Series.to_latex`

    Render Series to LaTeX-formatted table.

  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  |
      +----+----------+