Skip to content

pysparky.schema_ext

Functions

NameDescription
filter_columns_by_datatypeFilters and returns a StructType of StructField names from a given StructType schema

filter_columns_by_datatypefunction#

def filter_columns_by_datatype(struct_type: T.StructType, data_type: T.DataType) -> T.StructType

Filters and returns a StructType of StructField names from a given StructType schema that match the specified data type.

Parameters

NameTypeDescription
struct_typeT.StructTypeThe schema of the DataFrame.
data_typeT.DataTypeThe data type to filter by.

Returns

T.StructType
T.StructType: A StructType of StructField names that match the specified data type.