作用
lit(“haha”)->返回的字面值haha
方法
# df.withColumn(“time”,“201905”) 会报错,说没有引用其他列值
from pyspark.sql.functions import *
df=df.withColumn("time",lit("201905")) #这样就增加一列time,值全为201905字符串了
lit(“haha”)->返回的字面值haha
# df.withColumn(“time”,“201905”) 会报错,说没有引用其他列值
from pyspark.sql.functions import *
df=df.withColumn("time",lit("201905")) #这样就增加一列time,值全为201905字符串了