Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
ITables ChangeLog
=================

2.4.5 (2025-08-23)
------------------

**Fixed**
- The `showIndex` argument is now ignored when `df` is a Polars DataFrame ([#422](https://github.com/mwouts/itables/issues/422))
- The dependencies of the streamlit component have been updated to address security issues ([#420](https://github.com/mwouts/itables/pull/420), [#421](https://github.com/mwouts/itables/pull/421), [#425](https://github.com/mwouts/itables/pull/425))


2.4.4 (2025-07-07)
------------------

Expand Down
4 changes: 2 additions & 2 deletions src/itables/javascript.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,12 +347,12 @@ def _evaluate_show_index(df, showIndex) -> bool:
"""
We don't want to show trivial indices (RangeIndex with no name) on Pandas DataFrames.
"""
if showIndex != "auto":
return showIndex
if df is None:
return False
if pl is not pd and isinstance(df, pl.DataFrame):
return False
if showIndex != "auto":
return showIndex
if isinstance(df, pd.DataFrame):
return df.index.name is not None or not isinstance(df.index, pd.RangeIndex)
if pd_style is not None and isinstance(df, pd_style.Styler):
Expand Down
2 changes: 1 addition & 1 deletion src/itables/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""ITables' version number"""

__version__ = "2.4.4"
__version__ = "2.4.5"
15 changes: 14 additions & 1 deletion tests/test_polars.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest

from itables import to_html_datatable
from itables.javascript import datatables_rows
from itables.javascript import datatables_rows, get_itable_arguments
from itables.sample_dfs import (
get_dict_of_polars_test_dfs,
get_dict_of_polars_test_series,
Expand Down Expand Up @@ -53,3 +53,16 @@ def test_render_polars_struct():
datatables_rows(df.select(pl.col("X").value_counts(sort=True)))
== '[["{\\"C\\",3}"], ["{\\"A\\",2}"], ["{\\"B\\",1}"]]'
)


@pytest.mark.parametrize("show_index", ["auto", False, True])
def test_show_index_has_no_effect_on_polars_dataframes(show_index):
df = pl.DataFrame(
{
"A": [1, 2, 3],
"B": [4, 5, 6],
}
)
itable_args = get_itable_arguments(df, showIndex=show_index)
assert "data_json" in itable_args, set(itable_args)
assert itable_args["data_json"] == "[[1, 4], [2, 5], [3, 6]]"
Loading