You can download this code by clicking the button below.
This code is now available for download.
This function merges two Vaex DataFrames that are part of the same dataset but split into chunks. It is typically used when dealing with large datasets to optimize memory usage and computational efficiency.
Technology Stack : Vaex
Code Type : Function
Code Difficulty : Intermediate
import vaex as vx
def merge_chunks(chunk1, chunk2):
"""
Merges two Vaex DataFrames that are part of the same dataset but split into chunks.
Args:
chunk1 (vx.DataFrame): First chunk of the dataset.
chunk2 (vx.DataFrame): Second chunk of the dataset.
Returns:
vx.DataFrame: Merged DataFrame containing both chunks.
"""
merged_df = vx.concat([chunk1, chunk2])
return merged_df