Skip to main content

Table view for VIKTOR applications

Project description

Table view (open-source view for VIKTOR)

This repository can be installed in a VIKTOR application to show nicely formatted tables.

Example figure of a table result in a VIKTOR application

Installation

Paste the link of this repository in your requirements.txt:

viktor==14.4.0
git+https://github.com/viktor-platform/viktor_table_view.git

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;

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

viktor_table_view-0.1.1.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

viktor_table_view-0.1.1-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file viktor_table_view-0.1.1.tar.gz.

File metadata

  • Download URL: viktor_table_view-0.1.1.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for viktor_table_view-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ac8751f4e1d9e63166b87414259efdc9962ed784cc5e981cfda733eb3db12442
MD5 9b70190ec1d1ac091e6119d92488e6b3
BLAKE2b-256 c0f89b0d51b0b630786cf7e6098a5733608f5c9fa5ea76c709e7e9b6b738ca39

See more details on using hashes here.

File details

Details for the file viktor_table_view-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for viktor_table_view-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f4f42a75831b06b2bbfdec11f4fdedf9a379a28be54323a3acdbb69105b7dbbd
MD5 b54cdc150c9096b8ca972b5cd2b25e9c
BLAKE2b-256 6c96ce758aac63792dc5f9c341c9d4df87c4956137ae1ecca1ba624d1bfbb21b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page