How to create an effective logging system using excel, pandas, and numpy

Viewed 39

Background: I am creating a program that will need to keep track of what it has ran and when and what it has sent and to whom. The logging module in Python doesn't appear to accomplish what I need but I'm still pretty new to this so I may be wrong. Alternative solutions to accomplish the same end are also welcome.

The program will need to take in a data file (preferably .xlsx or .csv) which will be formatted as something like this (the Nones will need to be filled in by the program):

Run_ID Date_Requested Time_Requested Requestor Date_Completed Time_Completed
R_423h 9/8/2022 1806 email@email.com None None

The program will then need to compare the Run_IDs from the log to the new run_IDs provided in a similar format to the table above (in a .csv) ie:

ResponseId
R_jals893
R_hejl8234

I can compare the IDs myself, but the issue then becomes it will need to update the log with the new IDs it has ran, along with the times they were run and the emails and such, and then resave the log file. I'm sure this is easy but it's throwing me for a loop.

My code:

log = pd.read_excel('run_log.xlsx', usecols=None, parse_dates=True)

new_run_requests=pd.read_csv('Run+Request+Sheet_September+6,+2022_14.28.csv',parse_dates=True)

old_runs = log.Run_ID[:]

new_runs = new_run_requests.ResponseId[:]

log['Run_ID'] = pd.concat([old_runs, new_runs], ignore_index=True)

After this the dataframe does not change.

This is one of the things I have tried out of 2 or 3. Suggestions are appreciated!

0 Answers
Related