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 fromverticapy
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], } )
123col1Integer100%... 123col2Integer100%123col4Integer100%1 1 ... 1 1 2 2 ... 2 2 3 3 ... 3 3 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