Skip to content

Exceptions

typedframes.ColumnGroupError(column, first_match, second_match)

Bases: Exception

Exception raised when a column is matched by multiple ColumnSets or Columns.

Initialize the error.

Parameters:

Name Type Description Default
column str

The name of the column that matched multiple groups.

required
first_match Column | ColumnSet | None

The first Column or ColumnSet that matched.

required
second_match ColumnSet

The second ColumnSet that matched.

required
Source code in src/typedframes/column_group_error.py
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
def __init__(
    self,
    column: str,
    first_match: "Column | ColumnSet | None",
    second_match: "ColumnSet",
) -> None:
    """
    Initialize the error.

    Args:
        column: The name of the column that matched multiple groups.
        first_match: The first Column or ColumnSet that matched.
        second_match: The second ColumnSet that matched.

    """
    self._column = column
    self._first_match = first_match
    self._second_match = second_match
    super().__init__(str(self))

Attributes

column property

Return the name of the conflicting column.

Functions

__str__()

Return a string representation of the error message.

Source code in src/typedframes/column_group_error.py
33
34
35
36
37
def __str__(self) -> str:
    """Return a string representation of the error message."""
    first_name = getattr(self._first_match, "name", str(self._first_match))
    second_name = self._second_match.name
    return f"Column '{self._column}' matched by both '{first_name}' and '{second_name}'."

typedframes.MissingDependencyError(package, feature)

Bases: ImportError

Raised when an optional dependency is not installed.

Initialize with the missing package and feature that requires it.

Parameters:

Name Type Description Default
package str

The name of the missing package (e.g., "polars").

required
feature str

The feature that requires this package (e.g., "Column.col").

required
Source code in src/typedframes/missing_dependency_error.py
 7
 8
 9
10
11
12
13
14
15
16
17
def __init__(self, package: str, feature: str) -> None:
    """Initialize with the missing package and feature that requires it.

    Args:
        package: The name of the missing package (e.g., "polars").
        feature: The feature that requires this package (e.g., "Column.col").

    """
    self.package = package
    self.feature = feature
    super().__init__(f"{package} is required for {feature}. Install it with: pip install typedframes[{package}]")

Functions