Table view (open-source view for VIKTOR)
This repository can be installed in a VIKTOR application to show nicely formatted tables.
Installation
Paste the link of this repository in your requirements.txt:
viktor==14.4.0
viktor-table-view
Example implementation
The following could be an implementation of the TableView (app.py)
import numpy as np
import pandas as pd
from viktor import ViktorController
from viktor_table_view import TableResult
from viktor_table_view import TableView
class SampleEntity(ViktorController):
label = "SampleEntity"
@TableView("le view", duration_guess=1)
def le_view(self, **kwargs):
# Generate the data
data = np.random.randn(20, 6)
strings = np.array(["string1", "string2", "string3", "string4"])
string_data = np.random.choice(strings, size=(20, 4))
# Create the headers
headers1 = ["Text"] * 4 + ["Number"] * 6
headers2 = [f"Column {index + 1}" for index in range(0, 10)]
# Combine the headers and data into a dataframe
df = pd.DataFrame(np.column_stack([string_data, data]), columns=[headers1, headers2])
df.iloc[:, 4:] = df.iloc[:, 4:].astype(float)
df_colours = df.copy(deep=True)
df_colours.iloc[0, :] = "success"
df_colours.iloc[1, :] = "warning"
df_colours.iloc[2, :] = "error"
df_colours.iloc[3:, :] = pd.NA
return TableResult(df, dataframe_colours=df_colours, n_decimals={("Number", "Column 5"): 2})
Contributing
Improvements to the view are very welcome. Please ensure your improvements adhere to the code standards by running
black, isort and pylint (with the versions specified in dev-requirements.txt):
python -m black viktor_table_view/;
python -m isort viktor_table_view/;
python -m pylint viktor_table_view/ --rcfile=pyproject.toml;
Release files for viktor-table-view 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| viktor_table_view-0.1.2.tar.gz | 5.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| viktor_table_view-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.6 kB
Release files / viktor_table_view-0.1.2.tar.gz
| Download URL | viktor_table_view-0.1.2.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8ffe6d3e4fc8f3a299c1fb6703f29f96414d1a36f8c20d617cd833e3c9b32484
|
|
BLAKE2b-256 checksum How to use checksums |
c94fb5dc8539b927898a980172c461a48d6e4e0ed2349ee98d2dd3dede5ceb37
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|
Release files / viktor_table_view-0.1.2-py3-none-any.whl
| Download URL | viktor_table_view-0.1.2-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
44edb49badaa80ffc7812279458ec096c803ba2e985f013816e99390fa5b4c0c
|
|
BLAKE2b-256 checksum How to use checksums |
c5027f918d2cb9d153b95fe66255d55a1f8aec34a500a3e1a40b0a329a4387a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|