0

I am very new (self-learning) and I need some help writing code. I have two excel documents and I want to verify that the rows on the second document(Mech2) completely match the rows on the first document(Mech1). This is to verify that the out slots are connected to the in slots on the right modules in both documents. The rows will not be in the same order on both documents.

import numpy as np
import pandas as pd
from pandas import DataFrame 
from pandas import ExcelWriter
from pandas import ExcelFile

I read in the sheets

sheets = pd.read_excel(r'Mech1.xlsx', sheet_name= None, usecols= ['Module Out','Slot Out','Module In','Slot In'])

sheets2 = pd.read_excel(r'Mech2.xlsx', sheet_name= None, usecols= ['Module Out','Slot Out','Module In','Slot In'])

print (sheets)
print (sheets2)

I get the output

{'Sheet1':    Module Out  Slot Out Module In  Slot In
0        NPPN         1      VNPS        1
1        NPPN         2      LMTS        4
2        NPPN         3      VNPS        3
3        NPPN         4      VNPS        4
4        NPPN         5      LMTS        5
5        NPPN         6      GGRT        4
6        NPPN         7      VNPS        7
7        NPPN         8      VNPS        8
8        NPPW         1      LMTS        1
9        NPPW         2      GGRT        6
10       NPPW         3      LMTS        3
11       NPPW         4      GGRT        1
12       NPPW         5      GGRT        9
13       NPPW         6      LMTS        6
14       NPPW         7      GGRT        8
15       NPPW         8      LMTS        8
16       NPPW         9      LMTS        9
17       NPPW        10      GGRT        5
18       NPPS         1      GGRT        3
19       NPPS         2      VNPS        5
20       NPPS         3      LMTS        7
21       NPPS         4      GGRT        7
22       NPPS         5      LMTS       10
23       NPPS         6      VNPS        2
24       NPPS         7      VNPS        6
25       NPPS         8      LMTS        2
26       NPPS         9      GGRT        2}
{'Sheet1':    Module Out  Slot Out Module In  Slot In
0        NPPW         2      GGRT        6
1        NPPS         8      LMTS        2
2        NPPW         4      GGRT        1
3        NPPS         6      VNPS        2
4        NPPN         2      LMTS        4
5        NPPS         1      GGRT        3
6        NPPW         8      LMTS        8
7        NPPW         1      LMTS        1
8        NPPN         1      VNPS        1
9        NPPN         7      VNPS        8
10       NPPS         2      VNPS        5
11       NPPN         4      VNPS        4
12       NPPS         4      GGRT        7
13       NPPS         5      LMTS       10
14       NPPW        10      GGRT        5
15       NPPS         7      VNPS        6
16       NPPW         9      LMTS        9
17       NPPS         9      GGRT        2
18       NPPW         7      GGRT        8
19       NPPW         6      LMTS        6
20       NPPN         5      LMTS        5
21       NPPW         3      LMTS        3
22       NPPS         3      LMTS        7
23       NPPW         5      GGRT        9
24       NPPN         6      GGRT        4
25       NPPN         3      VNPS        3
26       NPPN         8      VNPS        8}

I am stuck At this point. Do I need to change it to a list, series, or array before using a for loop?

PilotSHC
  • 1
  • 1
  • 1
    Welcome! You might have a better chance of a good answer if you edit your question to explain what logic you need to apply on both tables, what have you researched so far in terms of solutions, and how the expected result should look like. Please read https://stackoverflow.com/help/how-to-ask – RichieV Jul 29 '20 at 00:30
  • Does [this](https://stackoverflow.com/questions/18180763/set-difference-for-pandas) answer your question? – Derek O Jul 29 '20 at 00:35
  • Thank you I am new to all of this. I have updated the question hopefully it makes better sense. – PilotSHC Jul 29 '20 at 03:56

0 Answers0