Explain the difference between 'merge' and 'join' methods in Pandas.
Instruction: Provide a detailed comparison between the 'merge' and 'join' methods, including their default behaviors.
Context: Candidates should demonstrate their understanding of the nuances between merging and joining DataFrames, including how indexes play a role in each method.
Updated
Official answer available
Read the opening below, then unlock the full answer and practical guidance.
Both methods combine data with join semantics. merge defaults to an inner join and can use columns, indexes or both. When keys are omitted, shared column names may be inferred, so specify them explicitly for predictable behavior...