Shimoku docs
Search…
Table
Resources on how to build a table with your data, and personalize it.

The method to use

The method is shimoku.plt.table()
It must contain the following input variables:
data: Union[str, DataFrame, List[Dict]]
menu_path: str
order: int
horizontal_scrolling: bool
overwrite: bool
And accepts the following input variables as optional:
title: Optional[str] = None
filter_columns: Optional[List[str]] = None
sort_table_by_cols: Optional[List] = None

Examples

1. Default configuration

This code generates a table with two filters:
data_ = [
{'date': dt.date(2021, 1, 1), 'x': 5, 'y': 5, 'filtA': 'A', 'filtB': 'B'},
{'date': dt.date(2021, 1, 2), 'x': 6, 'y': 5, 'filtA': 'B', 'filtB': 'Z'},
{'date': dt.date(2021, 1, 3), 'x': 4, 'y': 5, 'filtA': 'C', 'filtB': 'W'},
{'date': dt.date(2021, 1, 4), 'x': 7, 'y': 5, 'filtA': 'B', 'filtB': 'T'},
{'date': dt.date(2021, 1, 5), 'x': 3, 'y': 5, 'filtA': 'A', 'filtB': 'Z'},
]
filter_columns: List[str] = ['filtA', 'filtB']
shimoku.plt.table(
data=data_,
menu_path='test/table-1',
order=0,
filter_columns=filter_columns,
)
The result is:
The table is in the default configuration, it may be needed to scroll down the page.
The filters can be activated by clicking on them, and selecting the desired result:
Activating any filter by clicking on it.
Filtering for B using the filter filtA:
The choice of the filter appears as you select B.
The result is:
The result of a filter selection is shown.
You can rearrange alphabetically (direct or reverse order) the content of the table by clicking on a filter of your choice, in the body of the table. The result is like this:
Note the selection of filtA to show the alphabetical order.

2. Modifying the data frame and adding title:

You can personalize the table, changing column names in the input data frame, and add a title:
data_ = [
{'date': dt.date(2021, 1, 1), 'Bus1': 5, 'Bus2': 5, 'filtA': 'A', 'filtB': 'Z'},
{'date': dt.date(2021, 1, 2), 'Bus1': 6, 'Bus2': 7, 'filtA': 'B', 'filtB': 'Z'},
{'date': dt.date(2021, 1, 3), 'Bus1': 4, 'Bus2': 5, 'filtA': 'A', 'filtB': 'W'},
{'date': dt.date(2021, 1, 4), 'Bus1': 7, 'Bus2': 8, 'filtA': 'B', 'filtB': 'W'},
{'date': dt.date(2021, 1, 5), 'Bus1': 3, 'Bus2': 5, 'filtA': 'A', 'filtB': 'Z'},
{'date': dt.date(2021, 1, 6), 'Bus1': 5, 'Bus2': 5, 'filtA': 'A', 'filtB': 'Z'},
{'date': dt.date(2021, 1, 7), 'Bus1': 6, 'Bus2': 7, 'filtA': 'B', 'filtB': 'Z'},
{'date': dt.date(2021, 1, 8), 'Bus1': 4, 'Bus2': 5, 'filtA': 'A', 'filtB': 'W'},
{'date': dt.date(2021, 1, 9), 'Bus1': 7, 'Bus2': 5, 'filtA': 'B', 'filtB': 'W'},
{'date': dt.date(2021, 1, 10), 'Bus1': 3, 'Bus2': 7, 'filtA': 'A', 'filtB': 'Z'},
{'date': dt.date(2021, 1, 11), 'Bus1': 5, 'Bus2': 5, 'filtA': 'A', 'filtB': 'Z'},
{'date': dt.date(2021, 1, 12), 'Bus1': 6, 'Bus2': 5, 'filtA': 'B', 'filtB': 'Z'},
{'date': dt.date(2021, 1, 13), 'Bus1': 4, 'Bus2': 8, 'filtA': 'A', 'filtB': 'W'},
{'date': dt.date(2021, 1, 14), 'Bus1': 7, 'Bus2': 5, 'filtA': 'B', 'filtB': 'W'},
{'date': dt.date(2021, 1, 15), 'Bus1': 3, 'Bus2': 5, 'filtA': 'A', 'filtB': 'Z'},
{'date': dt.date(2021, 1, 16), 'Bus1': 5, 'Bus2': 8, 'filtA': 'A', 'filtB': 'Z'},
{'date': dt.date(2021, 1, 17), 'Bus1': 6, 'Bus2': 5, 'filtA': 'B', 'filtB': 'Z'},
{'date': dt.date(2021, 1, 18), 'Bus1': 4, 'Bus2': 7, 'filtA': 'A', 'filtB': 'W'},
{'date': dt.date(2021, 1, 19), 'Bus1': 7, 'Bus2': 5, 'filtA': 'B', 'filtB': 'W'},
{'date': dt.date(2021, 1, 20), 'Bus1': 3, 'Bus2': 7, 'filtA': 'A', 'filtB': 'Z'},
]
filter_columns: List[str] = ['filtA', 'filtB']
shimoku.plt.table(
data=data_,
menu_path='test/table-3',
order=0,
title="Amount of Buses in daily routes",
filter_columns=filter_columns,
sort_table_by_col={'date': 'asc'},
)
And get this result:
Table with more data and title.
Pagination
If you build a table with more than 10 rows, more pages are added and to show the entire table just click the > symbol:
Changing menu_path The menu_path can be modified.
It is possible to use any number of rows.
Copy link
On this page
The method to use
Examples
1. Default configuration
2. Modifying the data frame and adding title: