pyspark.sql.functions.partitioning.months#
- pyspark.sql.functions.partitioning.months(col)[source]#
Partition transform function: A transform for timestamps and dates to partition data into months.
New in version 4.0.0.
- Parameters
- col
Column
or str target date or timestamp column to work on.
- col
- Returns
Column
data partitioned by months.
Notes
This function can be used only in combination with
partitionedBy()
method of the DataFrameWriterV2.Examples
>>> df.writeTo("catalog.db.table").partitionedBy( ... partitioning.months("ts") ... ).createOrReplace()