如何使用 python 在另一个文件中获取两个 excel 文件的差异
how can i get difference of two excel file in another file using python
我有一个文件“product.xlsx”,它有 13 列和 2946 行。另一个文件“product_filter.xlsx”包含 13 列和 2609 行。
product_filter 具有相同的数据、相同的列 header 和相同的行数据。只是缺少 333 行。
我只想将 340 行放在不同的文件中。例如,在 product_remaning.xlsx.
我对python知之甚少。所以,如果可能的话,把你的解释写给对 python.
一无所知的人
谢谢
使用 pandas 和 read_excel, contact and drop_duplicates 应该可以为您解决这个问题。像这样的东西应该有用。
import pandas as pd
df1 = pd.read_excel(file_name1)
df2 = pd.read_excel(file_name2)
print(pd.concat([df1,df2]).drop_duplicates(keep=False))
我有一个文件“product.xlsx”,它有 13 列和 2946 行。另一个文件“product_filter.xlsx”包含 13 列和 2609 行。
product_filter 具有相同的数据、相同的列 header 和相同的行数据。只是缺少 333 行。 我只想将 340 行放在不同的文件中。例如,在 product_remaning.xlsx.
我对python知之甚少。所以,如果可能的话,把你的解释写给对 python.
一无所知的人谢谢
使用 pandas 和 read_excel, contact and drop_duplicates 应该可以为您解决这个问题。像这样的东西应该有用。
import pandas as pd
df1 = pd.read_excel(file_name1)
df2 = pd.read_excel(file_name2)
print(pd.concat([df1,df2]).drop_duplicates(keep=False))