pyspark.sql.functions.monthname#
- pyspark.sql.functions.monthname(col)[source]#
Returns the three-letter abbreviated month name from the given date.
New in version 4.0.0.
- Parameters
- col
Column
or str target date/timestamp column to work on.
- col
- Returns
Column
the three-letter abbreviation of month name for date/timestamp (Jan, Feb, Mar…)
Examples
>>> df = spark.createDataFrame([('2015-04-08',)], ['dt']) >>> df.select(monthname('dt').alias('month')).show() +-----+ |month| +-----+ | Apr| +-----+