Merging—Scenarios

Understand and apply various pandas techniques for different data scenarios.

Handling different JOIN scenarios

Beyond the JOIN operations explained in the previous chapter, there are numerous variations to how the merge() function can be used, depending on the user requirements and the structure of pandas objects.

Key column on index

Occasionally, we want to join on the index instead of a column. Let’s say our df_agents DataFrame now has the agent_id column inside its index instead of existing as a separate column:

Get hands-on with 1400+ tech skills courses.