pyspark.sql.functions.
year
Extract the year of a given date as integer.
New in version 1.5.0.
Examples
>>> df = spark.createDataFrame([('2015-04-08',)], ['dt']) >>> df.select(year('dt').alias('year')).collect() [Row(year=2015)]
previous
pyspark.sql.functions.xxhash64
next
pyspark.sql.functions.years