pythonpandasvenn-diagram

Pandas Visual Representation Joining DataFrames


Given these 3 dataframes and the venn diagramm below, one must determine which types of joins are used to get a joined dataframe that represents the venn diagram. Venn diagram to be replicateddffdfdf

The following image shows the options for merging them. the first two are quite obvious, being inner joins. for the last one the solution states that it is an outer join. enter image description here

What my question is and what i cannot wrap my head around is, why one would do an outer join. Would that not include the information from students which is not represented in the overlap between it external and staff?


Solution

  • You need to take into account that final_df joins student_external and student_staff, the results of the previous operations:

    enter image description here

    The inner join would only give you the central region (the intersection of all three sets).