Column Utils
Utilities for working with column names.
LaggedColumnPairs
dataclass
A dataclass to store information about a column and its lagged pairs.
Source code in amee_utils/feature_generator/feature_set/column_utils.py
find_period(column_name)
Extract the period from a column name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
column_name
|
str
|
The name of the column to extract the period from. |
required |
Returns:
| Type | Description |
|---|---|
int
|
The period extracted from the column name. |
Source code in amee_utils/feature_generator/feature_set/column_utils.py
find_prefix(column_name)
Find the prefix of a column name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
column_name
|
str
|
The name of the column. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The alphabetical characters at the beginning of the column name. |
Source code in amee_utils/feature_generator/feature_set/column_utils.py
get_pairs_from_columns(column_names)
Generate pairs of lagged columns from a list of column names.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
column_names
|
list of str
|
List of column names to generate pairs from. |
required |
Returns:
| Type | Description |
|---|---|
list of LaggedColumnPairs
|
List of LaggedColumnPairs objects containing the column name, prefix, and sorted pairs. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If a column name cannot be parsed. |