pyspark.pandas.Series.to_markdown¶
-
Series.
to_markdown
(buf: Union[IO[str], str, None] = None, mode: Optional[str] = None) → str¶ Print Series or DataFrame in Markdown-friendly format.
Note
This method should only be used if the resulting pandas object is expected to be small, as all the data is loaded into the driver’s memory.
- Parameters
- bufwritable buffer, defaults to sys.stdout
Where to send the output. By default, the output is printed to sys.stdout. Pass a writable buffer if you need to further process the output.
- modestr, optional
Mode in which file is opened.
- **kwargs
These parameters will be passed to tabulate.
- Returns
- str
Series or DataFrame in Markdown-friendly format.
Notes
Requires the tabulate package.
Examples
>>> psser = ps.Series(["elk", "pig", "dog", "quetzal"], name="animal") >>> print(psser.to_markdown()) | | animal | |---:|:---------| | 0 | elk | | 1 | pig | | 2 | dog | | 3 | quetzal |
>>> psdf = ps.DataFrame( ... data={"animal_1": ["elk", "pig"], "animal_2": ["dog", "quetzal"]} ... ) >>> print(psdf.to_markdown()) | | animal_1 | animal_2 | |---:|:-----------|:-----------| | 0 | elk | dog | | 1 | pig | quetzal |