I’m new to DS, is it possible please to compare two different DFs, with the same results output as in df.compare(df2)?
I tried using df.compare(df2), like ‘L’ with ‘R’, and ‘L’ with ‘N’ – below – but received the following error message:
ValueError: Can only compare identically-labeled (both index and columns) DataFrame objects
`
L = pd.DataFrame(
{
'FellowshipID': [1001, 1002, 1003, 1004],
'FirstName': ['Frodo', 'Samwise', 'Gandalf', 'Pippin'],
'Skills': ['Hiding', 'Gardening', 'Spells', 'Fireworks']
}
)
R = pd.DataFrame(
{
'FellowshipID': [1001, 1002, 1006, 1007, 1008],
'FirstName': ['Frodo', 'Samwise', 'Legolas', 'Elrond', 'Barromir'],
'Age': [50, 39, 2931, 6520, 51]
}
)
N = pd.DataFrame(
data = {
'Relation': ['fri 1', 'fri 2', 'fri 3', 'fri 4'],
'Name': ['John', 'Jane', 'Adam', 'Omar'],
'Char': ['Hw', 'Amb', 'Adv', 'Sprt']
}
)
`
Thank you 🙂