pyspark.sql.functions.dayofweek¶
-
pyspark.sql.functions.
dayofweek
(col: ColumnOrName) → pyspark.sql.column.Column¶ Extract the day of the week of a given date as integer. Ranges from 1 for a Sunday through to 7 for a Saturday
Examples
>>> df = spark.createDataFrame([('2015-04-08',)], ['dt']) >>> df.select(dayofweek('dt').alias('day')).collect() [Row(day=4)]