Loading...

verticapy.vDataFrame.shape#

vDataFrame.shape() tuple[int, int]#

Returns the number of rows and columns of the vDataFrame.

Returns#

tuple

(number of rows, number of columns)

Examples#

Let’s begin by importing VerticaPy.

import verticapy as vp

Hint

By assigning an alias to verticapy, we mitigate the risk of code collisions with other libraries. This precaution is necessary because verticapy uses commonly known function names like “average” and “median”, which can potentially lead to naming conflicts. The use of an alias ensures that the functions from verticapy are used as intended without interfering with functions from other libraries.

Let us create a vDataFrame with multiple columns:

vdf = vp.vDataFrame(
    {
        "col1": [1, 2, 3],
        "col2": [1, 2, 3],
        "col3": [1, 2, 3],
        "col4": [1, 2, 3],
    }
)

123
col1
Integer
100%
...
123
col2
Integer
100%
123
col4
Integer
100%
11...11
22...22
33...33

We can get the shape of the vDataFrame by:

vdf.shape()
Out[3]: (3, 4)

Note

This function differs from the pandas shape attribute since the size can be dynamically adjusted based on live modifications to the relation, such as the ingestion of new data or alterations to the relation.

If you want to ensure the stability of the relation, you can create a temporary local table or a table in a schema where only you have privileges.

See also

vDataFrame.iloc() : Select rows from the vDataFrame.