Loading...

verticapy.core.tablesample.base.TableSample.narrow#

TableSample.narrow(use_number_as_category: bool = False) tuple | list#

Returns the narrow representation of the TableSample.

Examples#

Let’s import the TableSample object:

from verticapy import TableSample

Let’s build an example object.

# dict with all the data.
d = {
    "customer_ID": [0, 1, 2, 3],
    "age": [40, 30, 22, 55],
    "name": ['Roger', 'Maria', 'Alisia', 'Costi'],
}


# creating the object.
tb = TableSample(d)
customer_ID
age
name
1040Roger
2130Maria
3222Alisia
4355Costi
Rows: 1-4 | Columns: 3

Let’s use the function.

tb.narrow()
Out[4]: 
[['age', 0, 40.0],
 ['age', 1, 30.0],
 ['age', 2, 22.0],
 ['age', 3, 55.0],
 ['name', 0, 'Roger'],
 ['name', 1, 'Maria'],
 ['name', 2, 'Alisia'],
 ['name', 3, 'Costi']]

See also

TableSample.merge() : Merges the input TableSample to a target TableSample.