Is there a way to get the element that belong only to a dataset d1 and not to another one d2, with pandas?
Refer the following Code -
df1 = pd.DataFrame({'A':[1,2,3,4,5],'B':[2,5,4,7,8],'C':[4,1,7,5,6],'D':[2,5,4,7,8]}) #First Dataframe
df2 = pd.DataFrame({'A':[1,2,3,4,5],'B':[2,5,4,7,8],'E':[5,6,7,4,4],'F':[5,7,8,9,4]}) #Second Dataframe
new_df = pd.concat([df1,df2],axis=1) # Concat the dataframes
new_df[list(set(new_df.columns).difference(df1.columns))] # Gives us Columns (E,F)
new_df[list(set(new_df.columns).difference(df2.columns))] # Gives us Columns (C.D)
If I have two datasets d1 and d2, where the d1 columns are:
d1_columns {X,Y,Z,T}
and for d2 :
d2_columns{X,Y,L,P}
Is there a function f such that:
f(d1,d2) = {Z,T} or equivalently: f(d1,d2) = {L,P} ?