pyspark.sql.functions.make_date#
- pyspark.sql.functions.make_date(year, month, day)[source]#
Returns a column with a date built from the year, month and day columns.
New in version 3.3.0.
Changed in version 3.4.0: Supports Spark Connect.
- Parameters
- Returns
Column
a date built from given parts.
Examples
>>> df = spark.createDataFrame([(2020, 6, 26)], ['Y', 'M', 'D']) >>> df.select(make_date(df.Y, df.M, df.D).alias("datefield")).collect() [Row(datefield=datetime.date(2020, 6, 26))]