Module pandas_profiling.report.presentation.flavours.qt.table

Expand source code
from PyQt5.QtWidgets import QTableWidget, QTableWidgetItem

from pandas_profiling.report.formatters import fmt
from pandas_profiling.report.presentation.core import Table


def get_table(items):
    from PyQt5.QtWidgets import QHeaderView

    table = QTableWidget()

    table.setRowCount(len(items))
    table.setColumnCount(2)

    horizontal = table.horizontalHeader()
    horizontal.setSectionResizeMode(QHeaderView.Stretch)
    horizontal.setVisible(False)

    vertical = table.verticalHeader()
    vertical.setVisible(False)

    for row_id, item in enumerate(items):
        table.setItem(row_id, 0, QTableWidgetItem(item["name"]))
        table.setItem(row_id, 1, QTableWidgetItem(fmt(item["value"])))

    return table


class QtTable(Table):
    def render(self):
        return get_table(self.content["rows"])

Functions

def get_table(items)
Expand source code
def get_table(items):
    from PyQt5.QtWidgets import QHeaderView

    table = QTableWidget()

    table.setRowCount(len(items))
    table.setColumnCount(2)

    horizontal = table.horizontalHeader()
    horizontal.setSectionResizeMode(QHeaderView.Stretch)
    horizontal.setVisible(False)

    vertical = table.verticalHeader()
    vertical.setVisible(False)

    for row_id, item in enumerate(items):
        table.setItem(row_id, 0, QTableWidgetItem(item["name"]))
        table.setItem(row_id, 1, QTableWidgetItem(fmt(item["value"])))

    return table

Classes

class QtTable (rows, name=None, **kwargs)

Helper class that provides a standard way to create an ABC using inheritance.

Expand source code
class QtTable(Table):
    def render(self):
        return get_table(self.content["rows"])

Ancestors

Methods

def render(self)
Expand source code
def render(self):
    return get_table(self.content["rows"])