Downsampling#
When an interactive table is displayed by itables
, the table data is embedded into the notebook itself. Large tables need to be downsampled, otherwise your notebook will become huge and irresponsive.
Downsampling occurs when the table data is larger than maxBytes
, which is equal to 64KB by default. When downsampling occurs, a warning is displayed below the table, which points to the itables
documentation.
If you wish, you can increase the value of maxBytes
or even deactivate the limit (with maxBytes=0
) - but again, that will break your notebook when you display a large dataframe.
Similarly, you can set a limit on the number of rows (maxRows
, defaults to 0) or columns (maxColumns
, defaults to 200
).
import itables
itables.init_notebook_mode()
itables.options.maxBytes = "8KB"
df = itables.sample_dfs.get_countries(html=False)
itables.downsample.as_nbytes(itables.options.maxBytes), itables.downsample.nbytes(df)
(8192, 8320)
df
Loading ITables v2.4.2 from the init_notebook_mode cell...
(need help?) |
To show the table in full, we can modify the value of maxBytes
either locally:
itables.show(df, maxBytes=32768)
Loading ITables v2.4.2 from the init_notebook_mode cell...
(need help?) |
or globally:
itables.options.maxBytes = "1MB"
df
Loading ITables v2.4.2 from the init_notebook_mode cell...
(need help?) |