How to add new column of gender male as and female as 1 February 09, 2023 Get link Facebook X Pinterest Email Other Apps cognizantHow to add new column of gender male as and female as 1df = spark.read.format("csv").option("header","True").load("file:////home/cloudera/namegen.txt")df.show()dfc = df.withColumn("status",expr("case when gender='male' then 0 else 1 end"))dfc.show() Comments
Comments
Post a Comment