【发布时间】:2020-03-31 09:20:35
【问题描述】:
Validate_shema(df, dic)
Df2=df.withcolumn('typ_freq',when(df.schema.["Frequency"].dataType != dic["Frequency"], False). Otherwise ('true')
Df2=df.withcolumn('typ_region',when(df.schema.["Region"].dataType != dic["Region"], False). Otherwise ('true')
Df2.show()
这给了我错误 - 条件必须是一列。
虽然,当我尝试验证长度时 - 比如 - df.withcolumn("len_freq",when(length(df["Freq"]) > dic["Freq"], False).otherwise(True) 这很成功。
谁能告诉解决方案为什么数据类型一不起作用?
【问题讨论】:
标签: python dataframe validation types pyspark