<jupyter_start><jupyter_text>The ``DataFrame`` widget allows displaying and editing a pandas DataFrame.For more information about listening to widget events and laying out widgets refer to the [widgets user guide](../../user_guide/Widgets.ipynb). Alternatively you can learn how to build GUIs by declaring parameters independently of any specific widgets in the [param user guide](../../user_guide/Param.ipynb). To express interactivity entirely using Javascript without the need for a Python server take a look at the [links user guide](../../user_guide/Param.ipynb). Parameters:For layout and styling related parameters see the [customization user guide](../../user_guide/Customization.ipynb). Core* **``editors``** (``dict``):  A dictionary mapping from column name to a bokeh CellEditor instance, which overrides the default.* **``fit_column``** (``boolean``): Whether columns should be fit to the available width. * **``formatters``** (``dict``): A dictionary mapping from column name to a bokeh CellFormatter instance, which overrides the default.* **``row_height``** (``int``): The height of each table row.* **``selection``** (``list``) The currently selected rows * **``value``** (``pd.DataFrame``): The pandas DataFrame to display and edit* **``widths``** (``dict``): A dictionary mapping from column name to column width in the rendered table. Display* **``disabled``** (boolean): Whether the widget is editable* **``name``** (str): The title of the widget___ The ``DataFrame`` widget renders an table which allows directly editing the contents of the dataframe with any changes being synced with Python. Note that it modifies the ``pd.DataFrame`` in place.<jupyter_code>df = pd.DataFrame({'int': [1, 2, 3], 'float': [3.14, 6.28, 9.42], 'str': ['A', 'B', 'C']}, index=[1, 2, 3])

pn.widgets.DataFrame(df)<jupyter_output><empty_output><jupyter_text>By default the widget will pick bokeh ``CellFormatter`` and ``CellEditor`` types appropriate to the dtype of the column. These may be overriden by explicit dictionaries mapping from the column name to the editor or formatter instance. For example below we create a ``SelectEditor`` instance to pick from four options in the ``str`` column and a ``NumberFormatter`` to customize the formatting of the float values:<jupyter_code>from bokeh.models.widgets.tables import SelectEditor, NumberFormatter

editor = SelectEditor(options=['A', 'B', 'C', 'D'])
formatter = NumberFormatter(format='0.00000') 

table = pn.widgets.DataFrame(df, editors={'str': editor}, formatters={'float': formatter})
table<jupyter_output><empty_output><jupyter_text>Once initialized the ``selection`` property will return the integer indexes of the selected rows and the ``selected_dataframe`` property will return a new DataFrame containing just the selected rows:<jupyter_code>table.selection = [0, 2]

table.selected_dataframe<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12837370242214532, 'fraction_numerical': 0.00795847750865052, 'mean_word_length': 6.034063260340632, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '34442', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 805, 'n_tokens_neox': 766, 'n_words': 336, 'path': 'examples/reference/widgets/DataFrame.ipynb', 'repo_name': 'kleavor/panel', 'size': '2890'}