MCPcopy
hub / github.com/pandas-dev/pandas / DataFrameRenderer

Class DataFrameRenderer

pandas/io/formats/format.py:875–1033  ·  view source on GitHub ↗

Class for creating dataframe output in multiple formats. Called in pandas.core.generic.NDFrame: - to_csv - to_latex Called in pandas.DataFrame: - to_html - to_string Parameters ---------- fmt : DataFrameFormatter Formatter with the forma

Source from the content-addressed store, hash-verified

873
874
875class DataFrameRenderer:
876 """Class for creating dataframe output in multiple formats.
877
878 Called in pandas.core.generic.NDFrame:
879 - to_csv
880 - to_latex
881
882 Called in pandas.DataFrame:
883 - to_html
884 - to_string
885
886 Parameters
887 ----------
888 fmt : DataFrameFormatter
889 Formatter with the formatting options.
890 """
891
892 def __init__(self, fmt: DataFrameFormatter) -> None:
893 self.fmt = fmt
894
895 def to_html(
896 self,
897 buf: FilePath | WriteBuffer[str] | None = None,
898 encoding: str | None = None,
899 classes: str | list | tuple | None = None,
900 notebook: bool = False,
901 border: int | bool | None = None,
902 table_id: str | None = None,
903 render_links: bool = False,
904 ) -> str | None:
905 """
906 Render a DataFrame to an html table.
907
908 Parameters
909 ----------
910 buf : str, path object, file-like object, or None, default None
911 String, path object (implementing ``os.PathLike[str]``), or file-like
912 object implementing a string ``write()`` function. If None, the result is
913 returned as a string.
914 encoding : str, default “utf-8”
915 Set character encoding.
916 classes : str or list-like
917 classes to include in the `class` attribute of the opening
918 ``<table>`` tag, in addition to the default "dataframe".
919 notebook : {True, False}, optional, default False
920 Whether the generated HTML is for IPython Notebook.
921 border : int or bool
922 When an integer value is provided, it sets the border attribute in
923 the opening tag, specifying the thickness of the border.
924 If ``False`` or ``0`` is passed, the border attribute will not
925 be present in the ``<table>`` tag.
926 The default value for this parameter is governed by
927 ``pd.options.display.html.border``.
928 table_id : str, optional
929 A css id is included in the opening `<table>` tag if specified.
930 render_links : bool, default False
931 Convert URLs to HTML links.
932 """

Callers 1

to_csvMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected