Loading...

verticapy.machine_learning.vertica.svm.LinearSVC.get_match_index#

static LinearSVC.get_match_index(x: str, col_list: list, str_check: bool = True) None#

Returns the matching index. This function is used to simplify the overall code.

Parameters#

x: str

Column’s name.

col_list: list

List of columns.

str_check: bool, optional

If set to True, checks if the formatted str is in the formatted list. No need for an exact match.

Returns#

int

index.

Examples#

The following code demonstrates the usage of the function.

# Import the Vertica Model.
from verticapy.machine_learning.vertica.base import VerticaModel

# Match
VerticaModel.get_match_index('b', ['"A"', '"B"', '"C"'])
Out[44]: 1

# str_check = False
VerticaModel.get_match_index('b', ['"A"', '"B"', '"C"'], str_check = False)

# No Match
VerticaModel.get_match_index('d', ['"A"', '"B"', '"C"'])

Note

These functions serve as utilities to construct others, simplifying the overall code.