我是spark的新手,请假定我具有如下数据框
sensor description
541163 PLC27.8Y.8Y35.Duration_R2_EquipmentDownCondition
541163 PLC27.8Y.8Y35.Duration_R2_EquipmentDownCondition
541163 PLC27.8Y.8Y35.Duration_R2_EquipmentDownCondition
541163 PLC27.MIS_PLC27.8Y.8Y35.Duration_R2_EquipmentDownCondition
541163 PLC27.MIS_PLC27.8Y.8Y35.Duration_R2_EquipmentDownCondition
327036 PLC12.MIS_PLC12.6X.6x60.Duration_ST_CyclingCondition
327041 PLC12.MIS_PLC12.6X.6x60.Duration_ST_TotalCycleCondition
327036 PLC12.MIS_PLC12.6X.6x60.Duration_ST_CyclingCondition
541142 PLC12.MIS_PLC12.6X.6x60.Duration_ST_DownCondition
327036 PLC12.MIS_PLC12.6X.6x60.Duration_ST_CyclingCondition
我想从description
列中创建新列:
description
包含"DownCondition"
,请返回0
CyclingCondition
,请返回1
EquipmentDownCondition
,请返回2