tablesample

In [ ]:
tablesample(values: dict = {}, 
            dtype: dict = {},
            count: int = 0, 
            offset: int = 0,
            percent: dict = {})

The tablesample is the transition from 'Big Data' to 'Small Data'. This object was created to have a nice way of displaying the results and to not have any dependency to any other module. It stores the aggregated result in memory and has some useful method to transform it to pandas.DataFrame or vDataFrame.

Parameters

Name Type Optional Description
values
dict
Dictionary of columns (keys) and their values. The dictionary must be similar to the following one: {"column1": [val1, ..., valm], ... "columnk": [val1, ..., valm]}
dtype
dict
Columns data types.
count
int
Number of elements if we had to load the entire dataset. It is used only for rendering purposes.
offset
int
Number of elements which had been skipped if we had to load the entire dataset. It is used only for rendering purposes.
percent
dict
Dictionary of missing values (Used to display the percent bars)

Attributes

The tablesample attributes are the same than the parameters.

Methods

Name Description
transpose Transposes the tablesample.
to_list Converts the tablesample to a list.
to_numpy Converts the tablesample to a numpy array.
to_pandas Converts the tablesample to a pandas DataFrame.
to_sql Generates the SQL query associated with the tablesample.
to_vdf Converts the tablesample to a vDataFrame.

Example

In [41]:
from verticapy.utilities import *
dataset = tablesample(values = {"index": [0, 1, 2],
                                "name": ["Badr", "Fouad", "Colin"],
                                "first_name": ["Ouali", "Teban", "Mahony"]})
display(dataset)
name
first_name
0BadrOuali
1FouadTeban
2ColinMahony
Rows: 1-3 | Columns: 3