actio_python_utils.spark_functions.serialize_struct_field¶
- actio_python_utils.spark_functions.serialize_struct_field(self, column, new_column, dtype, struct_columns_to_use=None)[source]¶
Serializes a
pyspark.sql.types.StructTypefield for output.- Parameters:
self (
DataFrame) – The dataframe to usecolumn (
str) – The name of the column to serializenew_column (
str) – The name to give the new serialized columndtype (
StructType) – The column definitionstruct_columns_to_use (
Optional[Container], default:None) – A set of struct values to use (assuming column is a struct)
- Raises:
NotImplementedError – If the type in the array is an array or struct
- Return type:
DataFrame- Returns:
A new dataframe with the serialized column