What is the primary purpose of the “merge” function in Pandas?

Aggregate data
Sort data
Combine DataFrames
Group data

The correct answer is: C. Combine DataFrames.

The merge function in Pandas is used to combine two or more DataFrames. It can be used to join DataFrames on a common column, or to concatenate them.

The aggregate function in Pandas is used to perform aggregate operations on a DataFrame. It can be used to calculate the mean, sum, or count of a column, or to group the DataFrame by a column and calculate the aggregate values for each group.

The sort function in Pandas is used to sort a DataFrame by a column. It can be sorted in ascending or descending order.

The group function in Pandas is used to group a DataFrame by a column. It can be used to calculate the mean, sum, or count of a column for each group, or to create a new DataFrame with the grouped data.

Here is an example of how to use the merge function:

“`
import pandas as pd

df1 = pd.DataFrame({‘A’: [1, 2, 3], ‘B’: [4, 5, 6]})
df2 = pd.DataFrame({‘C’: [7, 8, 9], ‘D’: [10, 11, 12]})

df = df1.merge(df2, on=’A’)

print(df)

A B C D
0 1 4 7
1 2 5 8
2 3 6 9
“`

In this example, the merge function has been used to combine the df1 and df2 DataFrames on the A column. The resulting DataFrame, df, has three columns: A, B, and C. The B and C columns come from the df1 and df2 DataFrames, respectively.