Reference
- pandas_sphinx.to_sphinx(df, show_index=False, number_rows=1)
Convert a pandas DataFrame into a Sphinx-based table ready to be added to a docstring.
A default output table looks like this:
+--------+-------+ | item | qty | +========+=======+ | spam | 42 | +--------+-------+ | … | … | +--------+-------+
item
qty
spam
42
…
…
- Parameters
df (pandas.DataFrame) – The pandas DataFrame to be converted into a Sphinx-based table.
show_index (bool, default False) – Include the pandas DataFrame index in the output table (
True) or not (False).number_rows (int, default 1) – The number of top rows of the pandas DataFrame to consider for the output table.
- Returns
The Sphinx-based table ready to be added to a docstring.
- Return type
str