| |
Methods defined here:
- __init__(self, data=None, input_columns=None, output_column=None, delimiter=',', include_column_name=True, data_sequence_column=None, data_order_column=None)
- DESCRIPTION:
The Pack function packs data from multiple input columns into a
single column. The packed column has a virtual column for each input
column. By default, virtual columns are separated by commas and each
virtual column value is labeled with its column name.
PARAMETERS:
data:
Required Argument.
The teradataml DataFrame containing the input attributes.
data_order_column:
Optional Argument.
Specifies Order By columns for data.
Values to this argument can be provided as list, if multiple columns
are used for ordering.
Types: str OR list of Strings (str)
input_columns:
Optional Argument.
Specifies the names of the input columns to pack into a single output
column. These names become the column names of the virtual columns.
By default, all input teradataml DataFrame columns are packed into a
single output column. If you specify this argument, but do not
specify all input teradataml DataFrame columns, the function copies
the unspecified input table columns to the output table.
Types: str OR list of Strings (str)
output_column:
Required Argument.
Specifies the name to give to the packed output column.
Types: str
delimiter:
Optional Argument.
Specifies the delimiter (a string) that separates the virtual columns
in the packed data.
Default Value: ","
Types: str
include_column_name:
Optional Argument.
Specifies whether to label each virtual column value with its column
name (making the virtual column "input_column:value").
Default Value: True
Types: bool
data_sequence_column:
Optional Argument.
Specifies the list of column(s) that uniquely identifies each row of
the input argument "data". The argument is used to ensure
deterministic results for functions which produce results that vary
from run to run.
Types: str OR list of Strings (str)
RETURNS:
Instance of Pack.
Output teradataml DataFrames can be accessed using attribute
references, such as PackObj.<attribute_name>.
Output teradataml DataFrame attribute name is:
result
RAISES:
TeradataMlException
EXAMPLES:
# Load the data to run the example.
load_example_data("Pack", "ville_temperature")
# Create teradataml DataFrame objects.
# The input, ville_temperature contains temperature readings for the
# cities Nashville and Knoxville, in the state of Tennessee.
ville_temperature = DataFrame.from_table("ville_temperature")
# Example1 - Default Argument Values.
# Default values used for arguments "delimiter" and "include_column_name".
pack_out1 = Pack(data=ville_temperature,
input_columns=['city','state','period','temp_f'],
output_column='packed_data',
delimiter=',',
include_column_name=True)
# Print the results
print(pack_out1.result)
# Example2 - Nondefault Argument Values.
# This example uses nondefault values for arguments "delimiter" and "include_column_name".
pack_out2 = Pack(data=ville_temperature,
input_columns=['city','state','period','temp_f'],
output_column='packed_data',
delimiter='|',
include_column_name=False)
# Print the results
print(pack_out2)
- __repr__(self)
- Returns the string representation for a Pack class instance.
- get_build_time(self)
- Function to return the build time of the algorithm in seconds.
When model object is created using retrieve_model(), then the value returned is
as saved in the Model Catalog.
- get_prediction_type(self)
- Function to return the Prediction type of the algorithm.
When model object is created using retrieve_model(), then the value returned is
as saved in the Model Catalog.
- get_target_column(self)
- Function to return the Target Column of the algorithm.
When model object is created using retrieve_model(), then the value returned is
as saved in the Model Catalog.
- show_query(self)
- Function to return the underlying SQL query.
When model object is created using retrieve_model(), then None is returned.
|