daft.DataFrame.into_partitions#
- DataFrame.into_partitions(num: int) DataFrame [source]#
Splits or coalesces DataFrame to
num
partitions. Order is preserved.This will naively greedily split partitions in a round-robin fashion to hit the targeted number of partitions. The number of rows/size in a given partition is not taken into account during the splitting.
Example
>>> import daft >>> df = daft.from_pydict({"x": [1, 2, 3], "y": [4, 5, 6], "z": [7, 8, 9]}) >>> df_with_5_partitions = df.into_partitions(5) >>> df_with_5_partitions.num_partitions() 5
- Parameters:
num (int) – number of target partitions.
- Returns:
Dataframe with
num
partitions.- Return type: