Skip to content

Tcrosstab

flowtask.components.tCrosstab

tCrosstab

tCrosstab(loop=None, job=None, stat=None, **kwargs)

Bases: tPandas

tCrosstab

Overview

Creates a cross-tabulation (contingency table) from a DataFrame.

Properties

.. table:: Properties :widths: auto

+------------------+----------+-----------+-----------------------------------------------------------------------------------+ | Name | Required | Type | Description | +------------------+----------+-----------+-----------------------------------------------------------------------------------+ | index | Yes | list | List of columns to be used as index in the crosstab. | +------------------+----------+-----------+-----------------------------------------------------------------------------------+ | columns | Yes | list | List of columns to be used as columns in the crosstab. | +------------------+----------+-----------+-----------------------------------------------------------------------------------+ | values | No | list | List of columns to be used as values in the crosstab. | +------------------+----------+-----------+-----------------------------------------------------------------------------------+ | aggregate | No | str | Aggregation function to use when values are provided. | +------------------+----------+-----------+-----------------------------------------------------------------------------------+ | totals | No | dict | Dictionary with 'name' key to add totals row/column. | +------------------+----------+-----------+-----------------------------------------------------------------------------------+ | reset_index | No | bool | Whether to reset the index after creating the crosstab. | +------------------+----------+-----------+-----------------------------------------------------------------------------------+ | alpha_first | No | bool | Whether to sort columns alphabetically if they start with letters. | +------------------+----------+-----------+-----------------------------------------------------------------------------------+

Return The dataframe with the crosstab transformation applied.