Project Details

macros2.py funtion ClasTiem()

July 5th 2023

"The dynamic path for the pending file is defined. The slope file ""Pendientes3.xlsx"" is read into a DataFrame. The path to read the ""Sheet1"" sheet from the ""NATIONAL SLOPE Plantilla_ESTADO 5.0 MODIFICADA1.xlsx"" file is defined. The file from the ""Hoja1.xlsx"" sheet is read into a DataFrame. A cross-reference is made between the Slope DataFrame and the DataFrame of the ""Sheet1"" sheet, where the ""Filing Branch"" of the pending file is searched for in the ""FILING OFFICES"" column of the sheet file, and the value of the ""OPPORTUNITY PROCESS"" column is returned. A new column called ""Classification"" is created in the slope DataFrame. The value of the ""PROCESS OPPORTUNITY"" column is assigned to the ""Classification"" in the slope DataFrame. A new column called ""Times"" is created in the Slope DataFrame. A function is defined to tag days according to certain criteria. The function is applied to the ""Days"" column and the results are assigned to the ""Times"" column in the Slope DataFrame. The path for saving the resulting ""Pendientes4.xlsx"" file is defined. The slope DataFrame is saved in a new Excel file without the index. Finally, the function returns a value of 2 if executed successfully. Otherwise, it returns the error line along with an explanatory message of the error." library: sys, pandas, datetime, os, openpyxl

macros2.py funtion ClasTiem()