让我们说我有两个熊猫数据框(df1和df2)。在这里,我提供一个示例,在实际情况下,有数百个列具有不同的数据类型和几百万行。数据类型并不总是匹配在两个数据帧中。如何获得仅存在于df1中的行和仅存在于df2中的行。此外,行更改了哪些列?
预期输出:
1)仅在df1中行 2)仅在df2中的行 3)值不相等的列
"df1":
id Name score (datatype = integer) isEnrolled (dt = sting) Comment (dt =string) Rank (dt = integer)
111 Jack 2.17 True He was late to class 2.3
112 Nick 1.11 False Graduated 3.3
113 Zoe 4.12 True 4.5
114 Dan 4.12 True 4.5
"df2":
id Name score (datatype = object) isEnrolled (dt = string) Comment (dt = string) Reason Date Rank(dt = float)
111 Jack 2.17 True He was late to class He was sleeping 03/23/2018 5.6
112 Nick 1.11 False He was late to class 04/22/2017 3.3
113 Zoe 4.14 False On vacation He is travelling