Skip to content

Commit 0ec5414

Browse files
committed
deploy: c1d6a89
1 parent cd346e4 commit 0ec5414

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+3119
-3180
lines changed

_sources/advanced_parameters.ipynb

Lines changed: 142 additions & 152 deletions
Large diffs are not rendered by default.

_sources/advanced_parameters.md

Lines changed: 41 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,25 @@ Below we give a series of examples of how the DataTables examples can be ported
2020

2121
As always, we initialize the `itables` library with
2222

23-
```{code-cell}
24-
from itables import init_notebook_mode, show
23+
```{code-cell} ipython3
24+
import itables
2525
26-
init_notebook_mode(all_interactive=True)
26+
itables.init_notebook_mode()
2727
```
2828

2929
Then we create two sample dataframes:
3030

31-
```{code-cell}
31+
```{code-cell} ipython3
3232
import pandas as pd
3333
34-
from itables.sample_dfs import get_countries
35-
3634
df_small = pd.DataFrame({"a": [2, 1]})
37-
df = get_countries(html=False)
35+
df = itables.sample_dfs.get_countries(html=False)
3836
```
3937

40-
```{code-cell}
38+
```{code-cell} ipython3
4139
:tags: [remove-cell]
4240
43-
import itables.options as opt
44-
45-
opt.lengthMenu = [5, 10, 20, 50, 100, 200, 500]
41+
itables.options.lengthMenu = [5, 10, 20, 50, 100, 200, 500]
4642
```
4743

4844
```{tip}
@@ -53,10 +49,10 @@ The rocket icon at the top of the page will let you run this notebook in Binder!
5349

5450
You can set additional `tags` on the table like e.g. a [caption](https://datatables.net/blog/2014-11-07):
5551

56-
```{code-cell}
52+
```{code-cell} ipython3
5753
:tags: [full-width]
5854
59-
show(df, "Countries from the World Bank Database")
55+
itables.show(df, "Countries from the World Bank Database")
6056
```
6157

6258
The caption appears at the bottom of the table by default: this is governed by `caption-side:bottom`
@@ -69,8 +65,8 @@ By default, datatables that don't fit in one page come with a search box, a pagi
6965
You can select which elements are actually displayed using
7066
DataTables' [`layout` option](https://datatables.net/reference/option/layout) with e.g.:
7167

72-
```{code-cell}
73-
show(df_small, layout={"topStart": "search", "topEnd": None})
68+
```{code-cell} ipython3
69+
itables.show(df_small, layout={"topStart": "search", "topEnd": None})
7470
```
7571

7672
The available positions are `topStart, topEnd, bottomStart, bottomEnd`. You can also use `top2Start`, etc... (see more
@@ -79,9 +75,7 @@ in the [DataTables documentation](https://datatables.net/reference/option/layout
7975
Like for the other arguments of `show`, you can change the default value of the dom option with e.g.:
8076

8177
```
82-
import itables.options as opt
83-
84-
opt.layout = {
78+
itables.options.layout = {
8579
"topStart": "pageLength",
8680
"topEnd": "search",
8781
"bottomStart": "info",
@@ -92,15 +86,15 @@ opt.layout = {
9286
```{tip}
9387
The `layout` option was introduced with `itables==2.0` and `DataTables==2.0`
9488
and deprecates the former [`dom` option](https://datatables.net/reference/option/dom).
95-
If you wish to continue using the `dom` option, set `opt.warn_on_dom = False`.
89+
If you wish to continue using the `dom` option, set `itables.options.warn_on_dom = False`.
9690
```
9791

9892
## Search
9993

10094
The [search option](https://datatables.net/reference/option/search) let you control the initial value for the search field, and whether the query should be treated as a regular expression or not:
10195

102-
```{code-cell}
103-
show(df, search={"regex": True, "caseInsensitive": True, "search": "s.ain"})
96+
```{code-cell} ipython3
97+
itables.show(df, search={"regex": True, "caseInsensitive": True, "search": "s.ain"})
10498
```
10599

106100
## Pagination
@@ -109,30 +103,30 @@ show(df, search={"regex": True, "caseInsensitive": True, "search": "s.ain"})
109103

110104
Select [how many entries](https://datatables.net/examples/advanced_init/length_menu.html) should appear at once in the table with either the `lengthMenu` argument of the `show` function, or with the global option `itables.options.lengthMenu`:
111105

112-
```{code-cell}
106+
```{code-cell} ipython3
113107
:tags: [full-width]
114108
115-
show(df, lengthMenu=[2, 5, 10, 20, 50])
109+
itables.show(df, lengthMenu=[2, 5, 10, 20, 50])
116110
```
117111

118112
### Show the table in full
119113

120114
Use [`paging=False`](https://datatables.net/reference/option/paging) to show the table in full:
121115

122-
```{code-cell}
116+
```{code-cell} ipython3
123117
:tags: [full-width]
124118
125-
show(df.head(8), paging=False)
119+
itables.show(df.head(8), paging=False)
126120
```
127121

128122
### Scroll
129123

130124
You can replace the pagination with a [vertical scroll](https://datatables.net/examples/basic_init/scroll_y.html):
131125

132-
```{code-cell}
126+
```{code-cell} ipython3
133127
:tags: [full-width]
134128
135-
show(df, scrollY="200px", scrollCollapse=True, paging=False)
129+
itables.show(df, scrollY="200px", scrollCollapse=True, paging=False)
136130
```
137131

138132
Since ITables 2.1.2, the `.dt-layout-table` div has a default overflow equal to `auto`, so in most cases you won't need to use the `scrollX` option of datatables.
@@ -141,62 +135,60 @@ Since ITables 2.1.2, the `.dt-layout-table` div has a default overflow equal to
141135

142136
Use `footer = True` if you wish to display a table footer.
143137

144-
```{code-cell}
138+
```{code-cell} ipython3
145139
:tags: [full-width]
146140
147-
show(df, footer=True)
141+
itables.show(df, footer=True)
148142
```
149143

150144
## Column filters
151145

152146
Use `column_filters = "header"` or `"footer"` if you wish to display individual column filters
153147
(remove the global search box with a [`layout`](layout) modifier if desired).
154148

155-
```{code-cell}
149+
```{code-cell} ipython3
156150
alpha_numeric_df = pd.DataFrame(
157151
[["one", 1.5], ["two", 2.3]], columns=["string", "numeric"]
158152
)
159153
160-
show(alpha_numeric_df, column_filters="footer", layout={"topEnd": None})
154+
itables.show(alpha_numeric_df, column_filters="footer", layout={"topEnd": None})
161155
```
162156

163157
As always you can set activate column filters by default with e.g.
164158

165-
```{code-cell}
166-
opt.column_filters = "footer"
159+
```{code-cell} ipython3
160+
itables.options.column_filters = "footer"
167161
```
168162

169163
Column filters also work on dataframes with multiindex columns:
170164

171-
```{code-cell}
172-
from itables.sample_dfs import get_dict_of_test_dfs
173-
174-
get_dict_of_test_dfs()["multiindex"]
165+
```{code-cell} ipython3
166+
itables.sample_dfs.get_dict_of_test_dfs()["multiindex"]
175167
```
176168

177-
```{code-cell}
169+
```{code-cell} ipython3
178170
:tags: [remove-cell]
179171
180-
opt.column_filters = False
172+
itables.options.column_filters = False
181173
```
182174

183175
## Row order
184176

185177
Since `itables>=1.3.0`, the interactive datatable shows the rows in the same order as the original dataframe:
186178

187-
```{code-cell}
188-
from itables.sample_dfs import get_dict_of_test_dfs
189-
190-
for name, test_df in get_dict_of_test_dfs().items():
179+
```{code-cell} ipython3
180+
for name, test_df in itables.sample_dfs.get_dict_of_test_dfs().items():
191181
if "sorted" in name:
192-
show(test_df, tags=f"<caption>{name}</caption>".replace("_", " ").title())
182+
itables.show(
183+
test_df, tags=f"<caption>{name}</caption>".replace("_", " ").title()
184+
)
193185
```
194186

195187
You can also set an explicit [`order`](https://datatables.net/reference/option/order) argument:
196188

197-
```{code-cell}
189+
```{code-cell} ipython3
198190
sorted_df = pd.DataFrame({"i": [1, 2], "a": [2, 1]}).set_index(["i"])
199-
show(sorted_df, order=[[1, "asc"]])
191+
itables.show(sorted_df, order=[[1, "asc"]])
200192
```
201193

202194
## Showing the index
@@ -207,14 +199,12 @@ it has a name, or when it differs from a range index. If you prefer, you can cha
207199

208200
You can change this behavior globally with e.g.
209201
```python
210-
import itables.options as opt
211-
212-
opt.showIndex = True
202+
itables.options.showIndex = True
213203
```
214204

215205
or locally by passing an argument `showIndex` to the `show` function:
216206

217-
```{code-cell}
207+
```{code-cell} ipython3
218208
df_with_range_index = pd.DataFrame({"letter": list("abcd")})
219-
show(df_with_range_index, showIndex=True)
209+
itables.show(df_with_range_index, showIndex=True)
220210
```

_sources/changelog.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
ITables ChangeLog
22
=================
33

4-
2.3.0-dev
5-
---------
4+
2.3.0 (2025-04-05)
5+
------------------
66

77
**Added**
88
- ITable now has a component for Dash! You can render your Python DataFrames in your Dash application with `from itables.dash import ITable` ([#245](https://github.com/mwouts/itables/issues/245))
99

10-
1110
**Changed**
12-
- We have upgraded `datatables.net-dt==2.2.2` and `datatables.net-select-dt==3.0.0`, and the dependency of both the Jupyter widget and the Streamlit component.
11+
- We have changed the default value of the `all_interactive` argument of `itables.init_notebook_mode` to `True`
12+
- The ITables options can be imported and modified directly through `itables.options`
13+
- We have updated `dt_for_itables` to `datatables.net-dt==2.2.2` and `datatables.net-select-dt==3.0.0`
14+
- We have updated the dependencies of our Jupyter widget and our of Streamlit component.
1315

1416

1517
2.2.5 (2025-02-22)

_sources/contributing.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"id": "ea69b296",
5+
"id": "677c7c3b",
66
"metadata": {},
77
"source": [
88
"# Contributing\n",
@@ -36,7 +36,7 @@
3636
{
3737
"cell_type": "code",
3838
"execution_count": 1,
39-
"id": "c0dddb4f",
39+
"id": "291aebc3",
4040
"metadata": {},
4141
"outputs": [
4242
{
@@ -69,7 +69,7 @@
6969
},
7070
{
7171
"cell_type": "markdown",
72-
"id": "0bb86b1d",
72+
"id": "2099ac07",
7373
"metadata": {},
7474
"source": [
7575
"## Support DataTables\n",

_sources/contributing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ It's always great to see new stars coming to ITables! <a class="github-button" h
3939

4040
If you wanted to share a link to ITables and DataTables (no obligation whatsoever), you could use something like this:
4141

42-
```{code-cell}
42+
```{code-cell} ipython3
4343
from IPython.display import HTML, display
4444
4545
display(

_sources/custom_css.ipynb

Lines changed: 97 additions & 101 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)