Data Pipeline
PandasDataPipeline
A data pipeline class that applies a series of steps to a pandas DataFrame.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
steps |
list
|
A list of functions or tuples (description, function) representing the steps to be applied. |
required |
name |
str
|
The name of the pipeline. Defaults to "pipeline". |
'pipeline'
|
Attributes:
Name | Type | Description |
---|---|---|
steps |
list
|
A list of functions or tuples (description, function) representing the steps to be applied. |
name |
str
|
The name of the pipeline. |
Methods:
Name | Description |
---|---|
apply |
pd.DataFrame) -> pd.DataFrame: Applies the pipeline steps to the given DataFrame. |
Source code in model_forge/data/datapipeline.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
|
apply(df)
Applies the pipeline steps to the given DataFrame.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df |
DataFrame
|
The DataFrame to apply the steps to. |
required |
Returns:
Type | Description |
---|---|
DataFrame
|
pd.DataFrame: The DataFrame after applying the steps. |
Source code in model_forge/data/datapipeline.py
96 97 98 99 100 101 102 103 104 105 106 107 108 |
|
safe(fn)
A decorator that creates a safe version of the decorated function. The safe version of the function makes a deep copy of the arguments and keyword arguments before calling the original function. This ensures that the original arguments are not modified during the function call.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fn |
function
|
The function to be decorated. |
required |
Returns:
Name | Type | Description |
---|---|---|
function |
The safe version of the decorated function. |
Source code in model_forge/data/datapipeline.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
|