I am trying to replace rows in a dataframe with rows from another dataframe. I have an excel file with all the existing product code in column 0 called 'MASTER.xlsx', and where the remaining columns are empty. I have another excel file called 'COUT PROJET - HOTEL DE VILLE.xlsx' containing some of the product codes in column 0 and where the remaining columns are filled with values.
Ultimately, I want to iterate through both the 'MASTER.xlsx' and 'COUT PROJET - HOTEL DE VILLE.xlsx' files. When the product code is in both files, I want to replace that respective row in 'MASTER.xlsx' with the filled out row from 'COUT PROJET - HOTEL DE VILLE.xlsx'. When the product code is not in 'COUT PROJET - HOTEL DE VILLE.xlsx', I want that row in 'MASTER.xlsx' to remain unchanged (empty).
import numpy as np
import pandas as pd
import time
import glob
df_master = pd.read_excel('MASTER.XLSX')
df = pd.read_excel('COÛT PROJET - HÔTEL DE VILLE.xlsx')
for index, column in df.iterrows(): 
        for index, row in df_master.iterrows():
            if row['DATE :'] == column['DATE :']:
                df_master.update(df)
            else:
                continue
                
        
df_master.to_excel('UPDATED COÛT PROJET - HÔTEL DE VILLE.xlsx')
The current code seems to partly work, however I think because the dataframes don't have the same size. I have included pictures of what the excel files look like. I apologize for my lack a knowledge, I am a beginner trying to help out the family business. Thank you for the help!
