-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
261 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,183 @@ | ||
--- | ||
jupytext: | ||
formats: md:myst | ||
notebook_metadata_filter: -jupytext.text_representation.jupytext_version | ||
text_representation: | ||
extension: .md | ||
format_name: myst | ||
format_version: 0.13 | ||
kernelspec: | ||
display_name: itables | ||
language: python | ||
name: itables | ||
--- | ||
|
||
# Sample dataframes | ||
|
||
In this notebook we make sure that our test [Ibis](https://ibis-project.org/) dataframes are displayed nicely with the default `itables` settings. | ||
|
||
```{code-cell} | ||
from itables import init_notebook_mode, show | ||
from itables.sample_dfs import get_dict_of_test_ibis_dfs | ||
dict_of_test_dfs = get_dict_of_test_ibis_dfs() | ||
init_notebook_mode(all_interactive=True) | ||
``` | ||
|
||
## empty | ||
|
||
```{code-cell} | ||
show(dict_of_test_dfs["empty"]) | ||
``` | ||
|
||
## No rows | ||
|
||
```{code-cell} | ||
show(dict_of_test_dfs["no_rows"]) | ||
``` | ||
|
||
## No rows one column | ||
|
||
```{code-cell} | ||
show(dict_of_test_dfs["no_rows_one_column"]) | ||
``` | ||
|
||
## No columns | ||
|
||
```{code-cell} | ||
show(dict_of_test_dfs["no_columns"]) | ||
``` | ||
|
||
## No columns one row | ||
|
||
```{code-cell} | ||
show(dict_of_test_dfs["no_columns_one_row"]) | ||
``` | ||
|
||
## bool | ||
|
||
```{code-cell} | ||
show(dict_of_test_dfs["bool"]) | ||
``` | ||
|
||
## Nullable boolean | ||
|
||
```{code-cell} | ||
show(dict_of_test_dfs["nullable_boolean"]) | ||
``` | ||
|
||
## int | ||
|
||
```{code-cell} | ||
show(dict_of_test_dfs["int"]) | ||
``` | ||
|
||
## Nullable integer | ||
|
||
```{code-cell} | ||
show(dict_of_test_dfs["nullable_int"]) | ||
``` | ||
|
||
## float | ||
|
||
```{code-cell} | ||
show(dict_of_test_dfs["float"]) | ||
``` | ||
|
||
## str | ||
|
||
```{code-cell} | ||
show(dict_of_test_dfs["str"]) | ||
``` | ||
|
||
## time | ||
|
||
```{code-cell} | ||
show(dict_of_test_dfs["time"]) | ||
``` | ||
|
||
## object | ||
|
||
```{code-cell} | ||
show(dict_of_test_dfs["object"]) | ||
``` | ||
|
||
## ordered_categories | ||
|
||
```{code-cell} | ||
show(dict_of_test_dfs["ordered_categories"]) | ||
``` | ||
|
||
## ordered_categories_in_multiindex | ||
|
||
```{code-cell} | ||
show(dict_of_test_dfs["ordered_categories_in_multiindex"]) | ||
``` | ||
|
||
## multiindex | ||
|
||
```{code-cell} | ||
show(dict_of_test_dfs["multiindex"]) | ||
``` | ||
|
||
## countries | ||
|
||
```{code-cell} | ||
:tags: [full-width] | ||
show(dict_of_test_dfs["countries"]) | ||
``` | ||
|
||
## capital | ||
|
||
```{code-cell} | ||
show(dict_of_test_dfs["capital"]) | ||
``` | ||
|
||
## complex_index | ||
|
||
```{code-cell} | ||
:tags: [full-width] | ||
show(dict_of_test_dfs["complex_index"]) | ||
``` | ||
|
||
## int_float_str | ||
|
||
```{code-cell} | ||
show(dict_of_test_dfs["int_float_str"]) | ||
``` | ||
|
||
## wide | ||
|
||
```{code-cell} | ||
:tags: [full-width] | ||
show(dict_of_test_dfs["wide"], maxBytes=100000, maxColumns=100, scrollX=True) | ||
``` | ||
|
||
## long_column_names | ||
|
||
```{code-cell} | ||
:tags: [full-width] | ||
show(dict_of_test_dfs["long_column_names"], scrollX=True) | ||
``` | ||
|
||
## duplicated_columns | ||
|
||
```{code-cell} | ||
show(dict_of_test_dfs["duplicated_columns"]) | ||
``` | ||
|
||
## named_column_index | ||
|
||
```{code-cell} | ||
show(dict_of_test_dfs["named_column_index"]) | ||
``` | ||
|
||
## big_integers | ||
|
||
```{code-cell} | ||
show(dict_of_test_dfs["big_integers"]) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,9 @@ dependencies: | |
- polars | ||
- pyarrow | ||
|
||
# Ibis | ||
- ibis-duckdb | ||
|
||
# Modin | ||
- modin-ray | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import pytest | ||
|
||
from itables import to_html_datatable | ||
from itables.javascript import datatables_rows | ||
from itables.sample_dfs import get_dict_of_test_ibis_dfs, get_dict_of_test_ibis_series | ||
|
||
pl = pytest.importorskip("ibis") | ||
|
||
|
||
@pytest.fixture(params=get_dict_of_test_ibis_dfs().items(), ids=lambda param: param[0]) | ||
def df(request): | ||
return request.param[1] | ||
|
||
|
||
@pytest.fixture( | ||
params=get_dict_of_test_ibis_series().items(), ids=lambda param: param[0] | ||
) | ||
def x(request): | ||
return request.param[1] | ||
|
||
|
||
def test_show_ibis_series(x, use_to_html): | ||
to_html_datatable(x, use_to_html) | ||
|
||
|
||
def test_show_ibis_df(df, use_to_html): | ||
to_html_datatable(df, use_to_html) | ||
|
||
|
||
def test_encode_mixed_contents(): | ||
# Make sure that the bigint escape works for mixed content # 291 | ||
df = pl.DataFrame( | ||
{ | ||
"bigint": [1666767918216000000], | ||
"int": [1699300000000], | ||
"float": [0.9510565400123596], | ||
"neg": [-0.30901700258255005], | ||
} | ||
) | ||
assert ( | ||
datatables_rows(df) | ||
== '[[BigInt("1666767918216000000"), 1699300000000, 0.9510565400123596, -0.30901700258255005]]' | ||
) |