Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from pyspark.sql.types import *
- from pyspark.sql import functions as F
- res = gdf.unionAll(
- gdf.select([
- F.lit('ALL').alias('SUMMARY_ID'),
- F.sum(gdf.upass).alias('upass'),
- F.sum(gdf.uin).alias('uin'),
- ]))
- def ConvertColumnType(df, col, newType):
- df = df.withColumn(col, df[col].cast(newType))
- return df
- gdf = ConvertColumnType(gdf, "upass", IntegerType())
Add Comment
Please, Sign In to add comment