I started my Python journey a few weeks ago. My main goal is to be able to automatize some aspects of my daily work routine, and in the future to dive more on Data Science. For now, I'm trying to make a script that will check if the values present on a certain column from sheet1 are also present on sheet2. I managed to get here:
I am new to data science and I am trying to compare two sheets and come to know whether sheet 1 values are present in sheet2. To know that I used the below code.
import pandas as pd
from pandas import ExcelWriter
from pandas import ExcelFile
pd.set_option('display.max_columns', 500)
df = pd.ExcelFile('C:\\Users\\Andre\\Desktop\\Scraps\\abacus.xlsx')
sheet1 = pd.read_excel(df, 'Sheet1')
sheet2 = pd.read_excel(df, 'Sheet2')
print(type(df))
print(sheet1)
print(sheet2)
df['Ref'] = df.lookup(df.index, df[sheet2['Ref']])
I know that my last line is incorrect, but it also states that 'ExcelFile' object has no attribute 'lookup', so I'm not managing to find a path to explore. Someone can point me a direction?
I know my code is not completely correct. It even throws me an error telling
'ExcelFile' object has no attribute 'lookup'
Can anyone help me?