Cast
Cast
In some cases It's useful to cast the datatype of subset of columns
CastTo
Bases: TransformerStep
Cast to a given datatype
Example
step = CastTo(type='float32')
Parameters:
Name | Type | Description | Default |
---|---|---|---|
type |
str
|
Data Type to cast to |
required |
name |
Optional[str]
|
Name of the step, by default None |
None
|
Source code in ceruleo/transformation/features/cast.py
transform(X)
Cast to a given datatype
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X |
DataFrame
|
DataFrame to transform |
required |
Returns:
Type | Description |
---|---|
DataFrame
|
Transformed DataFrame |
ToDateTime
Bases: TransformerStep
Cast to a datetime
Example
step = ToDateTime()
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
Optional[str]
|
Name of the step, by default None |
None
|
Source code in ceruleo/transformation/features/cast.py
__init__(*, units='s', name=None, columns=None, index=False)
Cast to a datetime
Parameters
units : str, optional The units to transform, by default "s" name : Optional[str], optional Name of the step, by default None columns : Optional[List[any]], optional Columns to transform, by default None index : bool, optional Wether to transform the index or not, by default False
Raises
ValueError description ValueError description
Source code in ceruleo/transformation/features/cast.py
transform(X)
Cast to a datetime
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X |
DataFrame
|
DataFrame to transform |
required |
Returns:
Type | Description |
---|---|
DataFrame
|
Transformed DataFrame |