Skip to content

Instantly share code, notes, and snippets.

@64lines
Created February 19, 2019 19:57
Show Gist options
  • Save 64lines/4467be73884f29d565a89effa3a1eba7 to your computer and use it in GitHub Desktop.
Save 64lines/4467be73884f29d565a89effa3a1eba7 to your computer and use it in GitHub Desktop.
from pyspark.sql.functions import *
fact_df = fact_df.withColumn('month', month('datecolumn')).alias('fact_df')
fact_df = fact_df.withColumn('day', dayofmonth('datecolumn')).alias('fact_df')
fact_df = fact_df.withColumn('year', year('datecolumn')).alias('fact_df')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment