tablesample.sort

In [ ]:
tablesample.sort(column: str, 
                 desc: bool = False)

Sorts the tablesample using the input column.

Parameters

Name Type Optional Description
column
str
Column used to sort the data.
desc
bool
If set to True, the result is sorted in descending order.

Returns

self : tablesample.

Example

In [15]:
from verticapy.utilities import tablesample

dataset = tablesample(values = {"index": ["region", "price", "quality"],
                                "Banana": ["Brazil", 2.3, 2],
                                "Manguo": ["Columbia", 6.7, 5],
                                "Apple": ["France", 1.5, 2]},).transpose()
display(dataset)
region
price
quality
BananaBrazil2.32
ManguoColumbia6.75
AppleFrance1.52
Rows: 1-3 | Columns: 4
In [16]:
# ASC
dataset.sort("price")
Out[16]:
region
price
quality
AppleFrance1.52
BananaBrazil2.32
ManguoColumbia6.75
Rows: 1-3 | Columns: 4
In [17]:
# DESC
dataset.sort("price", True)
Out[17]:
region
price
quality
ManguoColumbia6.75
BananaBrazil2.32
AppleFrance1.52
Rows: 1-3 | Columns: 4