A coder to encode CSV formatted data.
tft.coders.CsvCoder(
column_names,
schema,
delimiter=',',
secondary_delimiter=None,
multivalent_columns=None
)
Args |
column_names
|
Tuple of strings. Order must match the order in the file.
|
schema
|
A Schema proto.
|
delimiter
|
A one-character string used to separate fields.
|
secondary_delimiter
|
A one-character string used to separate values within
the same field.
|
multivalent_columns
|
A list of names for multivalent columns that need to
be split based on secondary delimiter.
|
Raises |
ValueError
|
If schema is invalid.
|
Methods
encode
View source
encode(
instance
)
Encode a tf.transform encoded dict to a csv-formatted string.
Args |
instance
|
A python dictionary where the keys are the column names and the
values are fixed len or var len encoded features.
|
Returns |
A csv-formatted string. The order of the columns is given by column_names.
|