first = [{'a':'aaa','b':'ccc','c':'bbb','d':'ddd'},
{'a':'bb','b':2,'c':1,'d':3},
{'a':'cc','b':22,'c':11,'d':33}]
second = [{'a':'aaa','b':'bbb','c':'ccc','d':'ddd'},
{'a':'bb','b':1,'c':2,'d':3},
{'a':'cc','b':11,'c':22,'d':33}]
table 2
|'a' | 'b' | 'c' |'d' |
|'aaa'|'bbb'|'ccc'|'ddd'|
|'bb' |1 |2 |3 |
|'cc' |11 |22 |33 |
table 1
|'a' | 'b' | 'c' |'d' |
|'aaa'|'ccc'|'bbb'|'ddd'|
|'bb' |2 |1 |3 |
|'cc' |22 |11 |33 |
In the tables above, the order of first row is same. The second row attributes are the primary keys. Even if their order change, but the values beneath are fine, they are equal
I have two tables and they transform to list of dictionaries in my code.The first row of the table is key for the dictionaries. I have to compare these two such that even if the column order changes from second row onward, the two entities are same. So in the example above, they are same.
In other words, the keys of dictionary are not the primary key for the table. the second row attributes are. How to write a code to perform such comparison.
The function compare() compares if first and second match according to what I understood is your equality criteria, and returns True if they are equal.