import pandas as pd
# 创建df1和df2数据框
df1 = pd.DataFrame({'日期': ['4-1', '4-2', '4-3', '4-5', '4-6', '4-6', '4-8', '4-9', '4-10'],
'车牌': [5, 6, 7, 8, 9, 10, 5, 8, 20],
'加油升数': [100, 70, 80, 90, 100, 101, 100, 90, 50]})
df2 = pd.DataFrame({'日期': ['4-1', '4-3', '4-3', '4-4', '4-6', '4-6', '4-7', '4-19', '4-11'],
'车牌': [5, 6, 6, 8, 11, 10, 5, 6, 20],
'加油升数': [100, 70, 60, 90, 100, 101, 120, 90, 60]})
# 将具有相同日期、车牌和加油升数的行合并到df_equal数据框中
df_equal = pd.merge(df1, df2, on=['日期', '车牌', '加油升数'], how='inner')
# 将df_equal的行从df1中删除,得到df_not_equal1数据框
df_not_equal1 = df1[~df1.isin(df_equal)].dropna()
# 将df_equal的行从df2中删除,得到df_not_equal2数据框
df_not_equal2 = df2[~df2.isin(df_equal)].dropna()
# 打印结果
print("相等的行:")
print(df_equal)
print("\ndf1中不相等的行:")
print(df_not_equal1)
print("\ndf2中不相等的行:")
print(df_not_equal2)