Support Questions
Find answers, ask questions, and share your expertise

pyspark tranformation

Highlighted

pyspark tranformation

Explorer

hi all,

I have spark dataframe like 

+------+--------------------+
|active|               email|
+------+--------------------+
|     1|jared.ely@sakilac...|
|     1|mary.smith@sakila...|
|     1|patricia.johnson@...|
|     1|linda.williams@sa...|
|     1|barbara.jones@sak...|
|     1|elizabeth.brown@s...|
|     1|jennifer.davis@sa...|
|     1|maria.miller@saki...|
|     1|susan.wilson@saki...|
|     1|margaret.moore@sa...|
|     1|dorothy.taylor@sa...|
|     1|lisa.anderson@sak...|
|     1|nancy.thomas@saki...|
|     1|karen.jackson@sak...|
|     1|betty.white@sakil...|
|     1|helen.harris@saki...|
|     0|sandra.martin@sak...|
|     1|donna.thompson@sa...|
|     1|carol.garcia@saki...|
|     1|ruth.martinez@sak...|
+------+--------------------+

requirement: if active== 1 then the corresponding email will change to @gmail.com

for example row 1: active = 1 then email= jared.ely@gmail.com

 

What is bet best way for transformation this case, using spark transformation?

 

Any suggestions will appreciate