Skip to content
C

Problem 2: Merge Two DataFrames

Easypython

Problem Description

Write a Python program that merges an "orders" DataFrame with a "customers" DataFrame on a shared "customer_id" column, using an inner join.

Input

Two DataFrames sharing a "customer_id" column.

Output

The merged DataFrame.

Constraints

  • At least 3 rows in each DataFrame.

Example Input

text
orders={"customer_id":[1,2,3],"amount":[100,150,200]} customers={"customer_id":[1,2,3],"name":["A","B","C"]}

Example Output

text
(A merged DataFrame with customer_id, amount, and name columns)

Concepts Covered

pd.merge(), how="inner".

Input (stdin)

Output

Run your code to see output here...