Kopīgot, izmantojot


make_date

Returns a column with a date built from the year, month and day columns.

For the corresponding Databricks SQL function, see make_date function.

Syntax

from pyspark.databricks.sql import functions as dbf

dbf.make_date(year=<year>, month=<month>, day=<day>)

Parameters

Parameter Type Description
year pyspark.sql.Column or str The year to build the date
month pyspark.sql.Column or str The month to build the date
day pyspark.sql.Column or str The day to build the date

Returns

pyspark.sql.Column: a date built from given parts.

Examples

from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([(2020, 6, 26)], ['Y', 'M', 'D'])
df.select('*', dbf.make_date(df.Y, 'M', df.D)).show()