ConvertColumnsOp¶
- class ConvertColumnsOp(parameters)[source]
Convert.
- Required remodeling parameters:
column_names (list): The list of columns to convert.
convert_to_ (str): Name of type to convert to. (One of ‘str’, ‘int’, ‘float’, ‘fixed’.)
decimal_places (int): Number decimal places to keep (for fixed only).
Methods
|
Constructor for the convert columns operation. |
|
Verify that the parameters meet the operation specification. |
|
Convert the specified column to a specified type. |
Attributes
|
- ConvertColumnsOp.__init__(parameters)[source]¶
Constructor for the convert columns operation.
- Parameters:
parameters (dict) – Parameter values for required and optional parameters.
- Raises:
KeyError –
If a required parameter is missing.
If an unexpected parameter is provided.
TypeError –
If a parameter has the wrong type.
ValueError –
If convert_to is not one of the allowed values.
- ConvertColumnsOp.check_parameters(parameters)¶
Verify that the parameters meet the operation specification.
- Parameters:
parameters (dict) – Dictionary of parameters for this operation.
- Raises:
KeyError –
If a required parameter is missing.
If an unexpected parameter is provided.
TypeError –
If a parameter has the wrong type.
- ConvertColumnsOp.do_op(dispatcher, df, name, sidecar=None)[source]¶
Convert the specified column to a specified type.
- Parameters:
dispatcher (Dispatcher) – Manages the operation I/O.
df (DataFrame) – The DataFrame to be remodeled.
name (str) – Unique identifier for the dataframe – often the original file path.
sidecar (Sidecar or file-like) – Only needed for HED operations.
- Returns:
A new DataFrame with the factor columns appended.
- Return type:
DataFrame
- ConvertColumnsOp.PARAMS = {'operation': 'convert_columns', 'optional_parameters': {'decimal_places': <class 'int'>}, 'required_parameters': {'column_names': <class 'list'>, 'convert_to': <class 'str'>}}¶