Pandas数据框可视化表示连接数据框。

huangapple go评论59阅读模式
英文:

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.

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.

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?

英文:

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.
Pandas数据框可视化表示连接数据框。

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.
Pandas数据框可视化表示连接数据框。

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?

答案1

得分: 2

你需要考虑 final_df 连接了 student_externalstudent_staff,这是之前操作的结果:

Pandas数据框可视化表示连接数据框。

内连接只会给你中心区域(三个集合的交集)。

英文:

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

Pandas数据框可视化表示连接数据框。

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

huangapple
  • 本文由 发表于 2023年6月29日 16:06:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/76579158.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定