DataFrame.to_html()

DataFrame.to_html(buf=None, columns=None, col_space=None, header=True, index=True, na_rep='NaN', formatters=None, float_format=None, sparsify=None, index_names=True, justify=None, bold_rows=True, classes=None, escape=True, max_rows=None, max_cols=None, show_dimensions=False, notebook=False, decimal='.', border=None) [source]

Render a DataFrame as an HTML table.

to_html-specific options:

bold_rows
: boolean, default True
Make the row labels bold in the output
classes

: str or list or tuple, default NoneCSS class(es) to apply to the resulting html table escape : boolean, default TrueConvert the characters <, >, and & to HTML-safe sequences.= max_rows : int, optionalMaximum number of rows to show before truncating. If None, show all. max_cols : int, optionalMaximum number of columns to show before truncating. If None, show all. decimal : string, default ?.?

Character recognized as decimal separator, e.g. ?,? in Europe

New in version 0.18.0.

border

: int

A border=border attribute is included in the opening <table> tag. Default pd.options.html.border.

New in version 0.19.0.

Parameters:

buf : StringIO-like, optional

buffer to write to

columns : sequence, optional

the subset of columns to write; default None writes all columns

col_space : int, optional

the minimum width of each column

header : bool, optional

whether to print column labels, default True

index : bool, optional

whether to print index (row) labels, default True

na_rep : string, optional

string representation of NAN to use, default ?NaN?

formatters : list or dict of one-parameter functions, optional

formatter functions to apply to columns? elements by position or name, default None. The result of each function must be a unicode string. List must be of length equal to the number of columns.

float_format : one-parameter function, optional

formatter function to apply to columns? elements if they are floats, default None. The result of this function must be a unicode string.

sparsify : bool, optional

Set to False for a DataFrame with a hierarchical index to print every multiindex key at each row, default True

index_names : bool, optional

Prints the names of the indexes, default True

line_width : int, optional

Width to wrap a line in characters, default no wrap

justify : {?left?, ?right?}, default None

Left or right-justify the column labels. If None uses the option from the print configuration (controlled by set_option), ?right? out of the box.

Returns:

formatted : string (or unicode, depending on data and options)

doc_Pandas
2017-01-12 04:46:42
Comments
Leave a Comment

Please login to continue.