Loading...

vastorbit.VastColumn.describe

VastColumn.describe(method: Literal['auto', 'numerical', 'categorical', 'cat_stats'] = 'auto', max_cardinality: int = 6, numcol: str | None = None) TableSample

This function aggregates the VastColumn using multiple statistical aggregations such as minimum (min), maximum (max), median, cardinality (unique), and other relevant statistics. The specific aggregations applied depend on the data types of the VastColumn. For example, numeric columns are aggregated with numerical aggregations (min, median, max…), while categorical columns are aggregated using categorical ones (cardinality, mode…). This versatile function provides valuable insights into the dataset’s statistical properties and can be customized to meet specific analytical requirements.

Parameters:
  • method (str, optional) –

    The describe method.

    • auto:

      Sets the method to numerical if the VastColumn is numerical, categorical otherwise.

    • categorical:

      Uses only categorical aggregations during the computation.

    • cat_stats:

      Computes statistics of a numerical column for each VastColumn category. In this case, the parameter numcol must be defined.

    • numerical:

      Uses popular numerical aggregations during the computation.

  • max_cardinality (int, optional) – Cardinality threshold to use to determine if the VastColumn is considered as categorical.

  • numcol (str, optional) – Numerical VastColumn to use when the parameter method is set to cat_stats.

Returns:

result.

Return type:

TableSample

Examples

For this example, we will use the following dataset:

import vastorbit as vo

data = vo.VastFrame(
    {
        "x": [1, 2, 4, 9, 10, 15, 20, 22],
        "y": [1, 2, 1, 2, 1, 1, 2, 1],
        "z": [10, 12, 2, 1, 9, 8, 1, 3],
        "c": ['A', 'A', 'A', 'A', 'B', 'B', 'C', 'D'],
    }
)

The describe method provides you with a variety of statistical methods.

The numerical parameter allows for the computation of numerical aggregations.

data["x"].describe(method = "numerical")
value
name"x"
dtypeinteger
unique8.0
count8.0
mean10.375
std8.016723591521485
min1.0
approx_25%4.0
approx_50%10.0
approx_75%20.0
max22.0
Rows: 1-11 | Columns: 2

The categorical parameter allows for the computation of categorical aggregations.

data["x"].describe(method = "categorical")
value
name"x"
dtypeinteger
unique8.0
count8.0
151
Others1
221
41
201
11
91
Rows: 1-11 | Columns: 2

The cat_stats parameter enables grouping by a categorical column and computing various aggregations on a numerical one.

data["c"].describe(
    method = "cat_stats",
    numcol = "x"
)
countpercentmeanstdminapprox_10%approx_25%approx_50%approx_75%approx_90%max
C112.520.0[null]20202020202020
D112.522.0[null]22222222222222
B225.012.53.535533905932737810101015151515
A450.04.03.5590260840104371124999
Rows: 1-4 | Columns: 12

Note

All the calculations are pushed to the database.

See also

VastColumn.aggregate() : Aggregations for a specific column.
VastFrame.aggregate() : Aggregations for specific columns.
VastFrame.describe() : Summarizes information within the columns.