verticapy.errors.MissingColumn#
- exception verticapy.errors.MissingColumn#
An exception raised when attempting to access or manipulate a specific column within a dataset that is missing or not present. This error typically indicates that the requested column is not available in the dataset, hindering the successful execution of the operation.
Examples#
The following function checks for the existence of the input column and raises an error if it does not exist.
from verticapy._utils._sql._sys import _executeSQL from verticapy.errors import MissingColumn def does_column_exists(table_name: str, column_name: str): query = f"SELECT * FROM columns WHERE table_name = '{table_name}' AND column_name = '{column_name}';" result = _executeSQL(query, method="fetchall") assert result, MissingColumn( f"The column '{column_name}' does not exist." )
Note
Errors can be employed when implementing new functions to provide clear explanations for why a particular option or feature is not functioning as intended. It is essential to review all available errors to choose the most appropriate one.