1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

2つのexcelファイルの差分がいかほどか確認する

Last updated at Posted at 2019-05-12

業務にて、2つのファイルの値の差分を求める必要がでてきたため2つの自動化プログラムを作成しました。

値が違うセルの数がいくつあるか調べる

import pandas as pd
import numpy as np

df_New = pd.read_excel("NEW_file.xlsx").fillna("null")
df_OLD = pd.read_excel("OLD_file.xlsx").fillna("null")

compare_values = df_New.values == df_OLD.values

rows.cols = np.where(compare_values)

diff_count = 0

for item in zip(rows,cols):
    diff_count += 1

print(diff_count)
1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?