DataFrame#

This component is also available in the classic reference.

The DataFrame pane renders pandas, dask and streamz DataFrame types using their custom HTML repr. Other DataFrame-like objects supported by Narwhals, e.g. polars and pyarrow, are rendered by converting them to pandas first, falling back to rendering the table directly if the conversion is not possible, e.g. because pandas or pyarrow are not installed.

Use pn.ui.DataFrame to create this component.

API#

.. py:class:: DataFrame(object=None, **params) :module: panel.pane.markup

The DataFrame pane renders pandas, dask and streamz DataFrame types using their custom HTML repr. Other DataFrame-like objects supported by Narwhals, e.g. polars and pyarrow, are rendered by converting them to pandas first, falling back to rendering the table directly if the conversion is not possible, e.g. because pandas or pyarrow are not installed.

In the case of a streamz DataFrame the rendered data will update periodically.

Reference: https://panel.holoviz.org/reference/panes/DataFrame.html

:Example:

DataFrame(df, index=False, max_rows=25, width=400)

:Attributes:

   **col_space**
       ..

   **float_format**
       ..

   **formatters**
       ..

   **justify**
       ..

   **max_cols**
       ..

   **max_rows**
       ..

   **text_align**
       ..

.. rubric:: Methods

.. autosummary::

  applies

.. !! processed by numpydoc !!

Parameter Definitions


Parameters inherited from:

   :class:`panel.viewable.Layoutable`: align, aspect_ratio, css_classes, design, height, min_width, min_height, max_width, max_height, styles, stylesheets, tags, width, width_policy, height_policy, sizing_mode, visible

   :class:`panel.viewable.Viewable`: loading

   :class:`panel.pane.base.PaneBase`: margin, default_layout, object

   :class:`panel.pane.markup.HTMLBasePane`: enable_streaming

   :class:`panel.pane.markup.HTML`: disable_math, sanitize_html, sanitize_hook

bold_rows = Boolean(default=True, label='Bold rows')

    Make the row labels bold in the output.

border = Integer(default=0, inclusive_bounds=(True, True), label='Border')

    A ``border=border`` attribute is included in the opening
    `<table>` tag.

classes = List(bounds=(0, None), default=['panel-df'], label='Classes')

    CSS class(es) to apply to the resulting html table.

col_space = ClassSelector(allow_None=True, class_=(<class 'str'>, <class 'int'>, <class 'dict'>), label='Col space')

    The minimum width of each column in CSS length units. An int
    is assumed to be px units.

decimal = String(default='.', label='Decimal')

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

escape = Boolean(default=True, label='Escape')

    Whether or not to escape the dataframe HTML. For security reasons
    the default value is True.

float_format = Callable(allow_None=True, label='Float format')

    Formatter function to apply to columns' elements if they are
    floats. The result of this function must be a unicode string.

formatters = ClassSelector(allow_None=True, class_=(<class 'dict'>, <class 'list'>), label='Formatters')

    Formatter functions to apply to columns' elements by position
    or name. The result of each function must be a unicode string.

header = Boolean(default=True, label='Header')

    Whether to print column labels.

index = Boolean(default=True, label='Index')

    Whether to print index (row) labels.

index_names = Boolean(default=True, label='Index names')

    Prints the names of the indexes.

justify = Selector(allow_None=True, label='Justify', names={}, objects=['left', 'right', 'center', 'justify', 'justify-all', 'start', 'end', 'inherit', 'match-parent', 'initial', 'unset'])

    How to justify the column labels.

max_rows = Integer(allow_None=True, inclusive_bounds=(True, True), label='Max rows')

    Maximum number of rows to display.

max_cols = Integer(allow_None=True, inclusive_bounds=(True, True), label='Max cols')

    Maximum number of columns to display.

na_rep = String(default='NaN', label='Na rep')

    String representation of NAN to use.

render_links = Boolean(default=False, label='Render links')

    Convert URLs to HTML links.

show_dimensions = Boolean(default=False, label='Show dimensions')

    Display DataFrame dimensions (number of rows by number of
    columns).

sparsify = Boolean(default=True, label='Sparsify')

    Set to False for a DataFrame with a hierarchical index to
    print every multi-index key at each row.

text_align = Selector(label='Text align', names={}, objects=['start', 'end', 'center'])

     Alignment of non-header cells.

_object = Parameter(allow_None=True, label=' object') Hidden parameter.

.. py:method:: DataFrame.applies(object: ~typing.Any) -> float | bool | None :module: panel.pane.markup :classmethod:

  Returns boolean or float indicating whether the Pane
  can render the object.

  If the priority of the pane is set to
  `None`, this method may also be used to define a float priority
  depending on the object being rendered.















  ..
      !! processed by numpydoc !!