## enable_tbl_preview()


Register [tbl_preview()](tbl_preview.md#great_docs.tbl_preview) as the default DataFrame display formatter.


Usage

``` python
enable_tbl_preview(**kwargs)
```


After calling this, any Polars or Pandas DataFrame that is the last expression in a cell (or passed to `display()`) will be rendered as a [tbl_preview()](tbl_preview.md#great_docs.tbl_preview) table instead of the library's default HTML.


## Parameters


`**kwargs: Any`  
Keyword arguments forwarded to [tbl_preview()](tbl_preview.md#great_docs.tbl_preview) (e.g., `n_head=10`, `show_all=True`, `show_dimensions=False`).


## Returns


`None`  
The formatter is registered as a side effect. IPython suppresses `None` output, so nothing is printed in the cell.


## Examples


``` python
import pandas as pd
import great_docs as gd

df = pd.DataFrame({"name": ["Alice", "Bob", "Carol"], "score": [92, 87, 95]})
```


Before enabling, the DataFrame renders with default Pandas HTML:


``` python
df
```


|     | name  | score |
|-----|-------|-------|
| 0   | Alice | 92    |
| 1   | Bob   | 87    |
| 2   | Carol | 95    |


After enabling, the same DataFrame renders as a [tbl_preview()](tbl_preview.md#great_docs.tbl_preview) table:


``` python
gd.enable_tbl_preview(n_head=3)
df
```


<table class="gt_table" data-quarto-disable-processing="true" data-quarto-bootstrap="false">
<thead>
<tr class="gt_heading">
<th colspan="3" class="gt_heading gt_title gt_font_normal"><div style="padding-top: 0; padding-bottom: 7px;">
<span class="gd-tbl-badge" style="background-color: #150458; color: #FFFFFF; border: 1px solid #150458; margin-right: 8px;">Pandas</span>Rows3Columns2
</div></th>
</tr>
<tr class="gt_col_headings">
<th class="gt_col_heading gt_columns_bottom_border gt_right" scope="col"></th>
<th id="name" class="gt_col_heading gt_columns_bottom_border gt_left" scope="col"><div>

name

<em>str</em>

</div></th>
<th id="score" class="gt_col_heading gt_columns_bottom_border gt_right" scope="col"><div>

score

<em>i64</em>

</div></th>
</tr>
</thead>
<tbody class="gt_table_body">
<tr>
<td class="gt_row gt_right gd-tbl-rownum">0</td>
<td class="gt_row gt_left" style="max-width: 231px">Alice</td>
<td class="gt_row gt_right" style="max-width: 234px">92</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">1</td>
<td class="gt_row gt_left" style="max-width: 231px">Bob</td>
<td class="gt_row gt_right" style="max-width: 234px">87</td>
</tr>
<tr>
<td class="gt_row gt_right gd-tbl-rownum">2</td>
<td class="gt_row gt_left" style="max-width: 231px">Carol</td>
<td class="gt_row gt_right" style="max-width: 234px">95</td>
</tr>
</tbody>
</table>


From this point on, all DataFrames (Pandas, Polars, or otherwise) will render using [tbl_preview()](tbl_preview.md#great_docs.tbl_preview) until [disable_tbl_preview()](disable_tbl_preview.md#great_docs.disable_tbl_preview) is called.


## See Also

[disable_tbl_preview()](disable_tbl_preview.md#great_docs.disable_tbl_preview)  
Remove the formatter and restore default display.

[tbl_preview()](tbl_preview.md#great_docs.tbl_preview)  
Generate a preview table for a single DataFrame.
