Loading...

verticapy.vDataFrame.isin#

vDataFrame.isin(val: dict) vDataFrame#

Checks whether specific records are in the vDataFrame and returns the new vDataFrame of the search.

Parameters#

val: dict

Dictionary of the different records. Each key of the dictionary must represent a vDataColumn. For example, to check if Badr Ouali and Fouad Teban are in the vDataFrame. You can write the following dict: {"name": ["Teban", "Ouali"], "surname": ["Fouad", "Badr"]}

Returns#

vDataFrame

The vDataFrame of the search.

Examples#

We import 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.

For this example, we will use a dummy dataset:

vdf = vp.vDataFrame(
    {
        "val": [3, 4, 5, 10, 12, 23],
        "cat": ['A', 'B', 'A', 'C', 'A', 'C'],
    }
)

123
val
Integer
100%
Abc
cat
Varchar(1)
100%
13A
24B
35A
410C
512A
623C

Note

VerticaPy offers a wide range of sample datasets that are ideal for training and testing purposes. You can explore the full list of available datasets in the Datasets, which provides detailed information on each dataset and how to use them effectively. These datasets are invaluable resources for honing your data analysis and machine learning skills within the VerticaPy environment.

Using isin we can easily filter through to get the desired results:

vdf.isin({"cat": ['A'], "val": [12]})
123
val
Integer
100%
Abc
cat
Varchar(1)
100%
112A

See also

vDataFrame.balance() : Balances the vDataFrame.
vDataFrame.at_time() : Filters the vDataFrame at a specific time.